[英]How can i bypass CORS Policy with ASP.NET and Ajax?
I want to bypass CORS Policy to GET data XML from another domain. 我想绕过CORS政策从另一个域获取数据XML 。 I try so much but have no luck. 我尝试了很多,但是没有运气。 There are: 有:
For you, JSONP is faster or Proxy is Faster ? 对您来说,JSONP更快还是Proxy更快?
Thanks for watching ? 谢谢收看
If the other domain does not explicitly trust you, you cannot invoke it from the client via AJAX for security reasons unless you use JSONP. 如果其他域未明确信任您,则出于安全原因,您不能通过AJAX从客户端调用它,除非您使用JSONP。
However, you can only use JSONP as long as you are sticking to only GET requests and the server knows how to respond with a JSONP-formatted response. 但是,只要您仅坚持GET请求,并且服务器知道如何使用JSONP格式的响应进行响应,就只能使用JSONP。
On the other hand, if they DO explicitly trust you, you have a few options. 另一方面,如果他们确实明确信任您,则您有几种选择。
On the other hand, if you create a proxy server-side on your end that can call across to the other domain, you'll have no issues whatsoever. 另一方面,如果您在端部创建了可以调用另一个域的代理服务器端,则不会有任何问题。
A server-side proxy should in theory always be slower than ajax options since you are making two calls instead of one. 理论上,服务器端代理应该总是比ajax选项要慢,因为您要进行两次调用而不是一次调用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.