Soms.Shared.Cors 2.2.0

dotnet add package Soms.Shared.Cors --version 2.2.0
                    
NuGet\Install-Package Soms.Shared.Cors -Version 2.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soms.Shared.Cors" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soms.Shared.Cors" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Soms.Shared.Cors" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soms.Shared.Cors --version 2.2.0
                    
#r "nuget: Soms.Shared.Cors, 2.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soms.Shared.Cors@2.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soms.Shared.Cors&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Soms.Shared.Cors&version=2.2.0
                    
Install as a Cake Tool

Soms.Shared.Cors

a lightweight library designed to simplify the configuration of Cross-Origin Resource Sharing (Cors) in .NET applications using appsettings.json.

Usage Example

To Configure Cors

builder.Services.ConfigureAppCors();

To Use Cors

app.UseAppCors();

Data for Cors in Appsettings.json File

{
    "cors": {
        "IsEnabled": true,
        "Name": "MyCorsPolicy",
        "Origins": ["example.com", "api.com"],
        "Headers": ["Accept", "Authorization", "X-Api-Version", "X-Correlation-Id"],
        "Methods": ["GET", "POST", "PATCH"],
        "ExposedHeaders": ["X-Pagination", "X-Correlation-Id", "X-Api-Version"],
        "AllowCredentials": true
    }
}

Json Fields Mandatory and Default Values

Property Mandatory Default Value
IsEnabled No false
Name No defaultPolicy
Origins Yes -
Headers No AllowAnyHeader
Methods No AllowAnyMethod
ExposedHeaders No None
AllowCredentials No None

Thank You!

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.0 96 5/9/2025
2.1.1 89 5/9/2025
2.1.0 88 5/9/2025
2.0.0 90 5/9/2025
1.1.0 90 5/9/2025
1.0.9 92 5/9/2025
1.0.8 90 5/9/2025
1.0.7 97 5/9/2025
1.0.6 91 5/9/2025
1.0.5 86 5/9/2025
1.0.4 89 5/9/2025
1.0.3 94 5/9/2025
1.0.2 89 5/9/2025
1.0.1 85 5/9/2025
0.5.1 92 5/9/2025
0.5.0 86 5/9/2025
0.4.1 90 5/9/2025
0.4.0 88 5/9/2025
0.3.0 88 5/9/2025
0.2.0 88 5/9/2025
0.1.9 97 5/9/2025
0.1.8 96 5/9/2025
0.1.7 93 5/9/2025
0.1.6 95 5/9/2025
0.1.5 94 5/9/2025
0.1.4 97 5/9/2025
0.1.3 91 5/9/2025
0.1.2 97 5/9/2025
0.1.1 94 5/9/2025
0.1.0 109 5/9/2025