c# - How can i bypass CORS Policy with ASP.NET and Ajax? -
i want bypass cors policy get data xml domain. try have no luck. there are:
- jsonp : way, don't know how use it. because xml construction difference jsonp construction. if yes, please me how use jsonp data xml domain.
- proxy: cause of project asp.net framework 4.0. so, create proxy page , use xml. example: http://localhost:4030/proxy.aspx?u=http://onotherdomain.com/data.xml . can't data basic protected site. it's allways return 401 unauthorized.
for you, jsonp faster or proxy faster ?
thanks watching ?
if other domain not explicitly trust you, cannot invoke client via ajax security reasons unless use jsonp.
however, can use jsonp long sticking requests , server knows how respond jsonp-formatted response.
on other hand, if explicitly trust you, have few options.
- cors support on server long using modern browsers (ie9 still has issues this) appropriate headers.
- xdomain, javascript proxy shim. however, requires explicit request domain inclusion.
on other hand, if create proxy server-side on end can call across other domain, you'll have no issues whatsoever.
a server-side proxy should in theory slower ajax options since making 2 calls instead of one.
Comments
Post a Comment