Enabling Cross-Origin Requests in ASP.NET Web API

Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘<domain>’ is therefore not allowed access. The response had HTTP status code 405.


We want to expose our api to be called from other domain. In default browsers doesen’t allow cross domain xhr requests.

To get it fixed we want to allow CORS in our web api.

I have created video on enabling CORS in web api.

watch video

More about CORS in Web api

jQuery ajax only works in IE when the IE debugger is open

It was very annoying. Ajax request not works perfectly in IE. But when developer tool is opened ajax quires are works fine. It was very cumbersome . It happened because IE chache Ajax requests. When Developer tool opened it is always refresh from server.

I get this fixed by making cache false in ajax request.

type: "GET",
url: url,
dataType: "html",
contentType: "application/json; charset=utf-8",
data: JSON.stringify({}),
cache: false,
success: function (r) {

I think it might help you.