Skip to content

Instantly share code, notes, and snippets.

@fxbeckers
Created July 17, 2013 15:38
Show Gist options
  • Save fxbeckers/6021728 to your computer and use it in GitHub Desktop.
Save fxbeckers/6021728 to your computer and use it in GitHub Desktop.
Allow Cross Site Json Attribute
public class AllowCrossSiteJsonAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
{
if (actionExecutedContext.Response != null)
actionExecutedContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");
base.OnActionExecuted(actionExecutedContext);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment