How to include System.Web.Http.Cors reference dll in .Net Web API
Asked Answered
M

3

31

I'm having a .NET Web API. I wish to make it as CORS Platform. So, I referred http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api

In the above link they explained very well how to make the Web API CORS. In the link they are using ICorsPolicyProvider.

I searched the net for ICorsPolicyProvider, I got a link https://msdn.microsoft.com/en-us/library/system.web.http.cors(v=vs.118).aspx, in the link they mentioned System.Web.Http.Cors Namespace

I searched the same in Reference Manager

enter image description here

Here I can't able to find the System.Web.Http.Cors Namespace. Kindly assist me how to include the referece System.Web.Http.Cors Namespace. I think this is a namespace from Microsoft, So, I didn't search in NuGet. Kindly assist me only in Microsoft.

Megalo answered 29/6, 2016 at 7:1 Comment(0)
T
73

Use Nuget, Microsoft use it for many great things as well.

Go to: TOOLS > Library Package Manager > Package Manager Console, and type in:

Install-Package Microsoft.AspNet.WebApi.Cors

Reference to the Nuget package here.

Here's another question on this topic

Trinitytrinket answered 29/6, 2016 at 7:44 Comment(0)
S
6

Answer from @Marcus is now outdated, System.Web.Http.Cors is no longer comes with Microsoft.AspNet.WebApi.Cors follow this link to install System.Web.Http.Cors Microsoft.AspNet.Cors

Shenitashenk answered 29/6, 2017 at 4:50 Comment(2)
I just installed Microsoft.AspNet.WebApi.Cors and System.Web.Http.Cors came with it.Calotte
I installed Microsoft.AspNet.Web.Api.Cors 5.2.6 just now and System.Web.Http.Cors came with it. The link you've pasted in your answer is talking about a different DLL entirely (System.Web.Cors)Germann
A
0

I could not include the Microsoft.AspNet.Cors package without problems when opening an old project in VS 2022 but after opening it in VS 2019, Shazam!, everything is fine! Maybe you should reinstall the package with Update-Package -reinstall Microsoft.AspNet.Cors.

Alanaalanah answered 8/2, 2024 at 16:21 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.