Logout Button wurde gefixed

This commit is contained in:
ja
2021-09-16 14:45:29 +02:00
parent 773c15e9e6
commit 64c3227b33
6 changed files with 86 additions and 43 deletions

View File

@@ -1,14 +1,33 @@

Imports System.Web.Configuration
Partial Class login_Logout
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs)
Dim sessionname
Sub Page_Load() Handles Me.Load
FormsAuthentication.SignOut()
Dim sessionname = Session.Item("lastpage").ToString
Session.Clear() 'clear session
Session.Abandon() 'Abandon session
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1))
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Cache.SetNoStore()
Response.Redirect(sessionname)
Session.Abandon()
'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("../newpageJulius_Sidebar.aspx")
End Sub
Protected Sub btn_backtostart_Click(sender As Object, e As EventArgs)
Response.Redirect("../newpageJulius_Sidebar.aspx")
End Sub
End Class