Safari 5.1基本身份验证注销问题

Safari 5.1基本身份验证注销问题,safari,basic-authentication,logout,Safari,Basic Authentication,Logout,我在我的站点中启用了基本身份验证。我能够在IE、Mozilla和Chrome中清除用户凭据,但无法从Safari中清除凭据 我尝试了以下方法 调用Ajax请求并将状态代码设置为401 使用URL中传递的用户名调用Ajax请求: 但这两种方法都不能正常工作。每当我关闭和打开一个新的safari时,凭证都不会被删除 下面是代码片段: 在注销页面中,我有以下脚本: $.ajax({ type: "POST", contentType: "application/javascript",

我在我的站点中启用了基本身份验证。我能够在IE、Mozilla和Chrome中清除用户凭据,但无法从Safari中清除凭据

我尝试了以下方法

  • 调用Ajax请求并将状态代码设置为
    401

  • 使用URL中传递的用户名调用Ajax请求:

  • 但这两种方法都不能正常工作。每当我关闭和打开一个新的safari时,凭证都不会被删除

    下面是代码片段:

    在注销页面中,我有以下脚本:

    $.ajax({
        type: "POST",
        contentType: "application/javascript",
        async: true,
        url: "../ClearAuthentication.aspx"
    });
    
    以及在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()
    

    我们也有同样的问题。我们成功地进行了以下黑客攻击。这类似于一个简单的登录请求,但具有错误的凭据

    function logout() {
        var request = new XMLHttpRequest();                                        
        request.open("get", "/rest/login", false, user.login, "false");                                                                                                                               
        request.send();                                                            
        window.location.replace("/");
    }
    
    这个解决方案是最后一个答案