I have code to make ajax calls to my web service in javascript as follows:
$.ajax(
{
url: url,
data: json,
type: "POST",
processData: false,
contentType: "application/json",
timeout: 10000,
dataType: "text",
global: false,
success: function (result, jqXHR)
{
sccParams = {
result: result,
jqXHR: jqXHR,
}
successResult(sccParams)
},
error: function (jqXHR, textStatus, errorThrown)
{
errParams = {
jqXHR: jqXHR,
textStatus: textStatus,
errorThrown: errorThrown,
}
errorHandler(errParams);
}
});
This works fine except if there is a 401 error in MS Edge. In this case I can see that the Ajax call is fired but then it looks as if MS Edge jumps in and handles the error and neither my success or error functions are called. My errorHandler has code to handle 401 errors but this never gets to run, instead I see the following in the console logs:
HTTP401: DENIED - The requested resource requires user authentication.
(XHR)POST - https://www.mywebsite.co.uk/WebService.svc/MyWebServiceRoutine
My webservice is hosted in azure and uses aspnet_Membership.
How can I get MS Edge to back off and let me handle my own errors? Other browsers work fine.