Last active
November 26, 2015 21:26
-
-
Save shammelburg/2185de2f0dfae0041d61 to your computer and use it in GitHub Desktop.
Angular Web API Access
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add to Global.asax.cs | |
protected void Application_BeginRequest() | |
{ | |
if (Request.Headers.AllKeys.Contains("Origin") && Request.HttpMethod == "OPTIONS") | |
{ | |
Response.Flush(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* web.config */ | |
<system.webServer> | |
<httpProtocol> | |
<customHeaders> | |
<add name="Access-Control-Allow-Origin" value="*" /> | |
<add name="Access-Control-Allow-Headers" value="Content-Type,Authorization" /> | |
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" /> | |
</customHeaders> | |
</httpProtocol> | |
</system.webServer> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment