码迷,mamicode.com
首页 > Web开发 > 详细

ASP.NET 跨域

时间:2015-01-15 17:51:24      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:

#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 跨域

标签:

原文地址:http://www.cnblogs.com/BigMouth/p/4226767.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!