在ASP.NET Webform中启用跨源请求 [英] Enabling Cross Origin Request in ASP.NET Webforms
本文介绍了在ASP.NET Webform中启用跨源请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个使用ASP.NET WebForms C#技术开发的API,该API完美返回了响应,但是由于跨源请求错误,我在AJAX中得到了响应。谁能指导我修复它。
I have an API developed using ASP.NET WebForms C# Technology, API is returning the response perfectly however I am getting the response in AJAX due to Cross Origin Request error. Can anyone please guide me on fixing it.
推荐答案
在您的web.config中添加
in your web.config add
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, POST, OPTIONS, PUT, DELETE" />
</customHeaders>
</httpProtocol>
</system.webServer>
这篇关于在ASP.NET Webform中启用跨源请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文