asp.net web api CORS

using System;
using System.Web.Http.Filters; 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);
}
}
上一篇:Intellij IDEA采用Maven+Spring MVC+Hibernate的架构搭建一个java web项目


下一篇:SQL Server 2008 备份改进版