Skip to content

Instantly share code, notes, and snippets.

@vbilopav
Created September 4, 2015 10:30
Show Gist options
  • Select an option

  • Save vbilopav/5fe8efccd82e66463aac to your computer and use it in GitHub Desktop.

Select an option

Save vbilopav/5fe8efccd82e66463aac to your computer and use it in GitHub Desktop.
protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "http://localhost:53738");
if (HttpContext.Current.Request.HttpMethod != "OPTIONS") return;
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "POST, PUT, DELETE");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept");
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000");
HttpContext.Current.Response.End();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment