Created
September 1, 2014 08:16
-
-
Save vongohren/0d365a2812287edfd22c to your computer and use it in GitHub Desktop.
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
using System.Web.Mvc; | |
namespace BEKK_Radar.Web.Helpers.CustomFilters | |
{ | |
public class CorsActionFilter : ActionFilterAttribute, IActionFilter | |
{ | |
void IActionFilter.OnActionExecuting(ActionExecutingContext context) | |
{ | |
if (context.HttpContext.Request.RequestType.Equals("POST")) return; | |
context.HttpContext.Response.AddHeader("Access-Control-Allow-Origin","*"); | |
context.HttpContext.Response.AddHeader("Access-Control-Allow-Methods", "GET"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment