1

退出页面后,如果用户没有关闭浏览器窗口并再次返回站点,则不会显示验证框,因为用户名和密码存储在浏览器缓存中。

在 IE 中,document.execCommand("ClearAuthenticationCache") 工作正常。但这似乎不适用于野生动物园。

我尝试了以下选项,

1)Response.Statuscode=401(从服务器端)- 这会清除身份验证缓存并提供凭据弹出窗口,但即使我们提供正确的凭据,它也不接受。如果我们单击取消并尝试再次访问该页面,那么它工作正常。

2) 使用XMLHttpRequestfrom客户端 - 当我尝试使用空白凭据打开同一站点上的 URL 时,readyState 和 statuscode 始终返回 0

 function testfn() {
        alert("send completed");
        alert(XMLHttp1.readyState);
    }
    function run()
    {
        XMLHttp1 = new XMLHttpRequest();
        XMLHttp1.onreadystatechange = testfn();
        XMLHttp1.open('GET', 'http://172.22.164.253/test/testxml.xml', true, '_', '_');
        try {
            XMLHttp1.wi
            XMLHttp1.send();
            alert("sent");
            alert("status" + XMLHttp1.status);
            alert(XMLHttp1.status == 401) ;
            } 
        catch (ex) {
            alert("Exception: Got an exception. " + ex);
        }
    }

3)清除缓存 - 用各种组合尝试了以下所有代码,但没有运气

Response.ExpiresAbsolute=DateTime.Now.AddDays(-1d);
Response.Expires =-1500;
Response.CacheControl = "no-cache";

Response.Redirect("Login.aspx");
Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);
Page.Response.Cache.SetNoStore();

请告知我在使用 Windows 身份验证处理 ASP.NET 页面时从 Safari 注销的解决方案。

4

0 回答 0