Logout Button wurde gefixed
This commit is contained in:
@@ -1,15 +1,24 @@
|
||||
|
||||
Imports System.Web.Configuration
|
||||
|
||||
Partial Class _Default
|
||||
Inherits System.Web.UI.Page
|
||||
Protected Sub LogoutButton_Click(sender As Object, e As EventArgs)
|
||||
FormsAuthentication.SignOut()
|
||||
Session.Abandon()
|
||||
|
||||
Session.Clear() 'clear session
|
||||
Session.Abandon() 'Abandon session
|
||||
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1))
|
||||
Response.Cache.SetCacheability(HttpCacheability.NoCache)
|
||||
Response.Cache.SetNoStore()
|
||||
Session.Add("lastpage", "../newpageJulius_Sidebar.aspx")
|
||||
'clear authentication cookie
|
||||
Dim cookie1 As HttpCookie = New HttpCookie(FormsAuthentication.FormsCookieName, "")
|
||||
cookie1.Expires = DateTime.Now.AddYears(-1)
|
||||
Response.Cookies.Add(cookie1)
|
||||
|
||||
'clear session cookie (Not necessary for your current problem but i would recommend you do it anyway)
|
||||
Dim sessionStateSection As New SessionStateSection
|
||||
sessionStateSection = WebConfigurationManager.GetSection("system.web/sessionState")
|
||||
Dim cookie2 As HttpCookie = New HttpCookie(sessionStateSection.CookieName, "")
|
||||
cookie2.Expires = DateTime.Now.AddYears(-1)
|
||||
|
||||
Response.Cookies.Add(cookie2)
|
||||
Response.Redirect("login/Logout.aspx")
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user