Hello guys,
I guess most of you have faced this kind of problem where an error of this kind written in console
"Cross-Origin XMLHttpRequest is blocked due to security reasons"
when you are either calling a webservice or webapi from a different origin in your project/solution.
Actually it simply means that your browser has blocked the XMLHttpRequest because your current application has different origin compared to originating Webapi or Webservice.
A simple solution to this is try to add these lines in your webconfig file which will allow the cross-origin XMLHttpRequest by your browser by default.
I guess most of you have faced this kind of problem where an error of this kind written in console
"Cross-Origin XMLHttpRequest is blocked due to security reasons"
when you are either calling a webservice or webapi from a different origin in your project/solution.
Actually it simply means that your browser has blocked the XMLHttpRequest because your current application has different origin compared to originating Webapi or Webservice.
A simple solution to this is try to add these lines in your webconfig file which will allow the cross-origin XMLHttpRequest by your browser by default.
<system.webServer> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="*"/> </customHeaders> </httpProtocol>
thanks. Have a nice day<system.webServer>
0 comments: