c# web api 跨域问题
2021-03-01 15:27
标签:text nta content api status object end toc global webconfig 中增加配置: Global.asax.cs文件中增加对于options支持 c# web api 跨域问题 标签:text nta content api status object end toc global 原文地址:https://www.cnblogs.com/bleychen/p/14318872.html protected void Application_BeginRequest(object sender, EventArgs e)
{
var req = System.Web.HttpContext.Current.Request;
if (req.HttpMethod == "OPTIONS")//过滤options请求,用于js跨域
{
Response.StatusCode = 200;
Response.SubStatusCode = 200;
Response.End();
}
}