Skip to content

Instantly share code, notes, and snippets.

@HenrikFrystykNielsen
Created March 27, 2014 18:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HenrikFrystykNielsen/6c934be6c6c8fa9e4bc8 to your computer and use it in GitHub Desktop.
Save HenrikFrystykNielsen/6c934be6c6c8fa9e4bc8 to your computer and use it in GitHub Desktop.
Note: this work around is no longer needed. Please see this blog for how to use CORS with Azure Mobile Services: http://azure.microsoft.com/blog/2014/07/28/azure-mobile-services-net-updates/
using System.Web.Http;
using Microsoft.WindowsAzure.Mobile.Service;
namespace henrikntest09Service
{
public class MyConfigBuilder : ConfigBuilder
{
public MyConfigBuilder(ConfigOptions options)
: base(options)
{
}
protected override void OnComplete(HttpConfiguration config)
{
config.EnableCors();
base.OnComplete(config);
}
}
}
@mikewiegand
Copy link

This no longer pertains as EnableCors() has been removed

@erizet
Copy link

erizet commented May 13, 2014

Is EnableCors removed?! Where is it removed from? I can still use it.

@mikewiegand
Copy link

I was mistaken the EnableCors is in the CORS nuget package which u need to install.

@matiasdecarli
Copy link

Hi Henrik. Im doing this, and also setting the rule before my method is call like this:

[EnableCors(origins: "", headers: "", methods: "*")]

I still got a No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:5000' is therefore not allowed access. Can you help me? Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment