Search code examples
asp.net.netasp.net-web-apivisual-studio-2013cors

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


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.


Solution

  • 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