首页 > 代码库 > ASP.NET 跨域

ASP.NET 跨域

#region 支持跨域请求            //Response.ClearHeaders();            string origin = Request.Headers["Origin"];            Response.AppendHeader("Access-Control-Allow-Origin",                string.IsNullOrEmpty(origin) ? "*" : origin);            string requestHeaders = Request.Headers["Access-Control-Request-Headers"];            Response.AppendHeader("Access-Control-Allow-Headers",                string.IsNullOrEmpty(requestHeaders) ? "*" : requestHeaders);            Response.AppendHeader("Access-Control-Allow-Methods", "POST, OPTIONS");            #endregion

 

ASP.NET 跨域