除非浏览器完全关闭ASP.NET-VB,否则应用程序不会注销

时间:2014-01-02 21:00:58

标签: asp.net vb.net active-directory

我开发了一个ASP.NET-VB应用程序;除了注销按钮外,一切正常。

除非在注销后完全关闭浏览器,否则应用程序不会完全注销。

如果我只是关闭选项卡而其他选项卡仍处于打开状态,则应用程序将保持登录状态,当用户再次访问该应用程序时,它将不会要求登录。

下面是我的退出按钮代码和web.config你可以告诉我这段代码中有什么变化。

仅供参考 - 活动目录用于身份验证

退出按钮

Protected Sub ButtonClose_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonClose.Click

    Me.Session.Clear()
    Me.Session.Abandon()

    HttpContext.Current.Session.Clear()
    HttpContext.Current.Session.Abandon()
    ViewState.Clear()
    FormsAuthentication.SignOut()

    Response.AddHeader("Cache-Control", "no-cache")
    Response.AddHeader("Pragma", "no-cache")
    Response.AddHeader("max-age", "1")
    Response.AddHeader("Expires", "-1")

    Response.Redirect("LogOut.aspx")
End Sub

1 个答案:

答案 0 :(得分:0)

在阅读完之后,这似乎是Windows身份验证开箱即用的方式,因此您可以考虑一项功能或限制...

http://forums.asp.net/t/1687661.aspx?How+to+create+a+flipcart+like+panel+for+showing+products+in+gridview

Logout MVC3 C# application with Windows Authentication

从上面的链接中,你可以使用一些javascript,所以也许你可以尝试一下,看看它是否有效?我不是说它是如何兼容跨浏览器的?

http://blog.geniar.com/index.php/2010/03/aspnet-mvc-ad-windows-authentication-how-to-logout/