1

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.

Rachel Edge
  • 351
  • 2
  • 6
  • 18

1 Answers1

0

The cause of this appears to be that, to check for an internet connection, my code made a call to an http site. Because my site is an https site this behaviour was deemed suspicious by MS Edge. So whenever I subsequently tried to access my web service MS Edge stepped in and denied my site access.

I've replaced the call to an http site with one to an https site and all now works fine.

Rachel Edge
  • 351
  • 2
  • 6
  • 18