30

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.

2 Answers 2

69

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

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

2
  • 7
    I just installed Microsoft.AspNet.WebApi.Cors and System.Web.Http.Cors came with it.
    – Agrejus
    Nov 3, 2017 at 14:36
  • 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)
    – ADyson
    Oct 31, 2018 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy