asp api接口支持跨域
来源:互联网 发布:如何加入网络作家协会 编辑:程序博客网 时间:2024/06/02 04:15
#region 支持跨域请求
Response.ClearHeaders();
Response.AppendHeader("Access-Control-Allow-Origin", "*");//过滤头部
if (HttpContext.Current.Request.HttpMethod == "OPTIONS") // 支持post跨域
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept,X-Requested-With");
}
#endregion
Response.ClearHeaders();
Response.AppendHeader("Access-Control-Allow-Origin", "*");//过滤头部
if (HttpContext.Current.Request.HttpMethod == "OPTIONS") // 支持post跨域
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept,X-Requested-With");
}
#endregion
阅读全文
0 0
- asp api接口支持跨域
- 如何让你的 Asp.Net Web Api 接口,拥抱支持跨域访问。
- 支持Ajax跨域访问ASP.NET Web Api 2(Cors)的示例
- [CORS:跨域资源共享] 通过扩展让ASP.NET Web API支持JSONP
- [CORS:跨域资源共享] 通过扩展让ASP.NET Web API支持W3C的CORS规范
- [CORS:跨域资源共享] ASP.NET Web API自身对CORS的支持:从实例开始
- ASP.NET Web API 支持 CORS
- [CORS:跨域资源共享] ASP.NET Web API自身对CORS的支持: EnableCorsAttribute特性背后的故事
- [CORS:跨域资源共享] ASP.NET Web API自身对CORS的支持: CORS授权检验的实施
- 允许api支持跨域方法
- springmvc接口支持跨域请求
- 农行网银支付API ASP接口
- 大众点评api接口 asp.net实例
- ASP.NET Web API 接口执行时间监控
- jsonp跨域请求API接口[自己写接口]
- PHP API接口调用跨域问题
- 快递查询API接口-支持国内上千快递查询-无验证码API接口
- IE11支持Javascript程序哪些新型API接口
- kali linux2.0 openvas服务启动失败解决方法
- Sqoop安装
- 拉格朗日插值算法Matlab实现
- mysql rownum的实现
- MySQL5.6 数据库主从(Master/Slave)同步安装与配置详解
- asp api接口支持跨域
- Project 控件Aspose.Tasks 12月新版17.12发布 | 附下载
- Set与List转换
- Centos搭建ceph+++一、虚拟机环境准备
- 欢迎使用CSDN-markdown编辑器
- ObjectBox[九] 数据模型变更
- 非常详细的Echars介绍
- JPEG系列二 JPEG文件中的EXIF(下)
- Qt中mouseMoveEvent无效