How to use new CORS support?

Topics: ASP.NET Web API
Mar 13, 2013 at 12:57 PM
Could we get an example or write up on how to use it? Looks great! Been using our own hacked together system for a while, but this looks vastly superior.

Thanks!
Mar 13, 2013 at 9:44 PM
Hi Geminiman,
Please take a look at the document here: http://aspnetwebstack.codeplex.com/wikipage?title=CORS%20support%20for%20ASP.NET%20Web%20API
I'll be adding more contents on this feature later.

Thanks,
Yao
Mar 14, 2013 at 2:20 PM
Thanks!

I got the latest nightlies and tried to add it per the instructions but I can't find System.Web.Http.Cors anywhere.

How do I add it?
Mar 14, 2013 at 5:37 PM
Since this was just checked in very recently, we’re still working on NuGet packages so that you can consume it from the nightly builds. For now, you’ll need to build the Runtime.sln and grab the following assemblies:
• System.Web.Cors.dll – this assembly contains the Core CORS library and has no dependency on System.Web or System.Web.Http.
• System.Web.Http.Cors.dll – this assembly contains the APIs for enabling CORS on Web API and has dependency on System.Web.Cors.dll and System.Web.Http.
Mar 26, 2013 at 2:54 PM
Got it working with the latest nuget nightlies! Awesome stuff!

Now if only $select worked.... :)
Mar 27, 2013 at 10:48 PM
Really glad to see this!

I had just started working to use the ThinkTecture code so having it brought on-board is great. There is a NuGet package available (searched 'cors') from the Nightly (2013 Mar 27) but so far when I reference it in a VS2012 WebApi (.Net 4.5) solution the compiler complains about a version mismatch , I assume because the cors DLLs are marked 5.0 and the System.Web.Http being 4.0

Actualk error :

Error 1 Assembly 'System.Web.Http.Cors, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' C:\Data\WebSites\devel\serexx\Serexx.Distribute\Serexx.Distribute.WebApi\bin\System.Web.Http.Cors.dll Serexx.Distribute.WebApi

I know there is away around this but I can't rmember or figure out what it is.... tried Sn.exe -Vr on the two cors DLLs in case it was a delay signing issue, but no joy.

Any guidance would be greatly appreciated!
Coordinator
Mar 28, 2013 at 5:36 PM
Looks like you need to update System.Web.Http.dll to the latest nightly build.

Daniel Roth
Microsoft
Apr 5, 2013 at 10:30 PM
Yes, now you can just grab the CORS package from the nightly builds. Here is a step by step walkthrough: http://blogs.msdn.com/b/yaohuang1/archive/2013/04/05/try-out-asp.net-web-api-cors-support-using-the-nightly-builds.aspx

Thanks,
Yao
Apr 5, 2013 at 10:34 PM
Thanks!
Jul 6, 2013 at 1:42 AM
I'm also running into the version mismatch issue with System.Web.Http - how can I update this to the latest version?