1

I have basic authentication enabled in my site. I able to clear user credential in IE, Mozilla and Chrome but not able to clear credential from Safari.

I tried the following

  1. Calling an Ajax request and setting status code to 401

  2. Calling an Ajax request with username passed in URL: http://invalidUSer@site.com

But both of them are not working properly. Whenever I close and open a new safari credentials are not at all removed.

Below is the code snippet:

In logoout Page i have following scripts:

$.ajax({
    type: "POST",
    contentType: "application/javascript",
    async: true,
    url: "../ClearAuthentication.aspx"
});

And in ClearAuthentication.aspx.vb

'Context.Response.Redirect("http://www.test.com", False) ' have tried this both adding and removing
Response.StatusCode = 401
Page.Response.StatusDescription = "Unauthorized"
'Page.Response.AppendHeader("WWW-Authenticate", "Basic realm=""foo""") ' have tried this both adding and removing
Context.Response.End()
Boris Y.
  • 4,387
  • 2
  • 32
  • 50
Srinivas
  • 21
  • 5

1 Answers1

0

We have same problem. We succeeded with following hack. It's like a simple login request but with false credentials.

function logout() {
    var request = new XMLHttpRequest();                                        
    request.open("get", "/rest/login", false, user.login, "false");                                                                                                                               
    request.send();                                                            
    window.location.replace("/");
}

This solution is last answer on the question.

Community
  • 1
  • 1
Boris Y.
  • 4,387
  • 2
  • 32
  • 50