none
MS Edge handles 401 errors thus bypassing my error handler RRS feed

  • Question

  • 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.

    Am I correct in thinking that MS Edge might be bypassing my error handling? If so, how can I stop it doing this? Other browsers work fine.
       
    Thursday, July 6, 2017 2:04 PM

Answers