I have enabled CORS in web api and i am able to catch error in jquery ajax call with correct status code when unauthorized request are made. But i find that if method with some name is not exist in controller than i am not able to catch 404 error in ajax call. Following errors are returned
OPTIONS "{url}" 404 (Not Found) jquery.js:9666 XMLHttpRequest cannot load {url}. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
I think its problem with cors which is not adding headers when method is not exist. Is there any way to resolve this issue?