| name | migrating-webapi-cors |
| description | Migrates legacy ASP.NET Web API CORS (Microsoft.AspNet.WebApi.Cors) to ASP.NET Core CORS (Microsoft.AspNetCore.Cors). Use ONLY when Microsoft.AspNet.WebApi.Cors has been flagged as obsolete or deprecated and must be replaced — not for version-bump scenarios where Microsoft.AspNet.WebApi.Cors is still supported.
|
| metadata | {"discovery":"lazy","traits":".NET|CSharp|VisualBasic|DotNetCore"} |
ASP.NET Web API CORS to ASP.NET Core CORS Migration
Overview
Migrate CORS configuration from ASP.NET Web API (Microsoft.AspNet.WebApi.Cors) to ASP.NET Core (Microsoft.AspNetCore.Cors). The core change is moving from attribute-driven CORS registered via EnableCorsAttribute on HttpConfiguration to a middleware-based approach using services.AddCors() and app.UseCors(). Named policies replace the per-attribute origin/header/method strings.
Package Reference Changes
Old References (Remove)
<PackageReference Include="Microsoft.AspNet.WebApi.Cors" Version="5.*" />
<PackageReference Include="Microsoft.AspNet.Cors" Version="5.*" />
New Reference (Add)