Logout ist nun von überall ohne Session Cookies möglich

This commit is contained in:
ja
2021-09-16 16:17:08 +02:00
parent 1deb7365f5
commit 506ed3197e
6 changed files with 30 additions and 31 deletions

View File

@@ -2,7 +2,7 @@
Partial Class Customers_Customers Partial Class Customers_Customers
Inherits System.Web.UI.MasterPage Inherits System.Web.UI.MasterPage
Protected Sub LogoutButton1_Click(sender As Object, e As EventArgs) Protected Sub LogoutButton1_Click(sender As Object, e As EventArgs)
MsgBox("Logged out!")
Response.Redirect("../login/Logout.aspx") Response.Redirect("../login/Logout.aspx")
End Sub End Sub
End Class End Class

View File

@@ -5,7 +5,7 @@
<html lang="en"></html> <html lang="en"></html>
<!-- Required meta tags --> <!-- Required meta tags -->
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1" title="Verag Spedition AG AvisoTV Flex"/> <meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="shortcut icon" href="../images/Icons/favicon/favicon.ico" /> <link rel="shortcut icon" href="../images/Icons/favicon/favicon.ico" />
<style> <style>
.nav-item dropdown::marker { .nav-item dropdown::marker {

View File

@@ -19,13 +19,9 @@
</head> </head>
<body> <body>
<form id="form1" runat="server"> <form id="form1" runat="server">
<div> <div>
<%If Me.Page.User.Identity.IsAuthenticated = False Then %>
<h1>Du wurdest erfolgreich ausgeloggt.</h1> <h1>Du wurdest erfolgreich ausgeloggt.</h1>
<button type="button" id="btn_backtostart" class="btn btn-primary">Zurück zur Startseite!</button> <button type="button" id="btn_backtostart" class="btn btn-primary">Zurück zur Startseite!</button>
<%Else %>
<h1>Du bist noch eingeloggt <%=Me.User.Identity.Name %>.</h1>
<%End If %>
</div> </div>
</form> </form>

View File

@@ -6,23 +6,23 @@ Partial Class login_Logout
Dim sessionname Dim sessionname
Sub Page_Load() Handles Me.Load Sub Page_Load() Handles Me.Load
FormsAuthentication.SignOut() FormsAuthentication.SignOut()
Session.Abandon() Session.Clear()
'clear authentication cookie 'clear authentication cookie
Dim cookie1 As HttpCookie = New HttpCookie(FormsAuthentication.FormsCookieName, "") 'Dim cookie1 As HttpCookie = New HttpCookie(FormsAuthentication.FormsCookieName, "")
cookie1.Expires = DateTime.Now.AddYears(-1) 'cookie1.Expires = DateTime.Now.AddYears(-1)
Response.Cookies.Add(cookie1) 'Response.Cookies.Add(cookie1)
'clear session cookie 'clear session cookie
Dim sessionStateSection As New SessionStateSection 'Dim sessionStateSection As New SessionStateSection
sessionStateSection = WebConfigurationManager.GetSection("system.web/sessionState") 'SessionStateSection = WebConfigurationManager.GetSection("system.web/sessionState")
Dim cookie2 As HttpCookie = New HttpCookie(sessionStateSection.CookieName, "") 'Dim cookie2 As HttpCookie = New HttpCookie(sessionStateSection.CookieName, "")
cookie2.Expires = DateTime.Now.AddYears(-1) 'cookie2.Expires = DateTime.Now.AddYears(-1)
'Response.Cookies.Add(cookie2)
Response.Cookies.Add(cookie2)
Response.Redirect("../newpageJulius_Sidebar.aspx") Response.Redirect("../newpageJulius_Sidebar.aspx")
End Sub End Sub

View File

@@ -309,7 +309,10 @@
</li> </li>
<li> <li>
<a href="status_Julius.aspx?&lan=<%=laenderkuerzel %>" data-toggle="tooltip" data-placement="right" rel="nofollow" target="_blank" title="Nur durch erfolgreichen Login erreichbar.">Status</a> <a href="status_Julius.aspx?&lan=<%=laenderkuerzel %>" data-toggle="tooltip" data-placement="right" rel="nofollow" target="_blank" title="Nur durch erfolgreichen Login erreichbar.">Status</a>
</li> </li>
<li>
<a href="../login/Logout.aspx" data-toggle="tooltip" data-placement="right" rel="nofollow" title="Ausloggen.">Logout</a>
</li>
</ul> </ul>
</li> </li>
@@ -547,10 +550,10 @@
</a> --> </a> -->
<asp:LoginView ID="LoginView1" runat="server"> <asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate> <AnonymousTemplate>
<iframe id="frame1" src="login/login_FLEX.aspx" runat="server" seamless="seamless" style="width:300px;height:300px;overflow:no-content;background-image:none;" scrolling="no" /> <iframe id="frame1" src="/login/login_FLEX.aspx" runat="server" seamless="seamless" style="width:300px;height:300px;overflow:no-content;background-image:none;" scrolling="no" />
</AnonymousTemplate> </AnonymousTemplate>
<LoggedInTemplate> <LoggedInTemplate>
<iframe id="frame2" src="login/Loggedin.aspx" runat="server" seamless="seamless" style="width:300px;height:300px;overflow:no-content;background-image:none;" scrolling="no" /> <iframe id="frame2" src="/login/Loggedin.aspx" runat="server" seamless="seamless" style="width:300px;height:300px;overflow:no-content;background-image:none;" scrolling="no" />
</LoggedInTemplate> </LoggedInTemplate>
</asp:LoginView> </asp:LoginView>
<div style="height:10px"></div> <div style="height:10px"></div>

View File

@@ -5,19 +5,19 @@ Partial Class _Default
Inherits System.Web.UI.Page Inherits System.Web.UI.Page
Protected Sub LogoutButton_Click(sender As Object, e As EventArgs) Protected Sub LogoutButton_Click(sender As Object, e As EventArgs)
FormsAuthentication.SignOut() FormsAuthentication.SignOut()
Session.Abandon() Session.Clear()
'clear authentication cookie 'clear authentication cookie
Dim cookie1 As HttpCookie = New HttpCookie(FormsAuthentication.FormsCookieName, "") 'Dim cookie1 As HttpCookie = New HttpCookie(FormsAuthentication.FormsCookieName, "")
cookie1.Expires = DateTime.Now.AddYears(-1) 'cookie1.Expires = DateTime.Now.AddYears(-1)
Response.Cookies.Add(cookie1) 'Response.Cookies.Add(cookie1)
'clear session cookie 'clear session cookie
Dim sessionStateSection As New SessionStateSection 'Dim sessionStateSection As New SessionStateSection
sessionStateSection = WebConfigurationManager.GetSection("system.web/sessionState") 'SessionStateSection = WebConfigurationManager.GetSection("system.web/sessionState")
Dim cookie2 As HttpCookie = New HttpCookie(sessionStateSection.CookieName, "") 'Dim cookie2 As HttpCookie = New HttpCookie(sessionStateSection.CookieName, "")
cookie2.Expires = DateTime.Now.AddYears(-1) 'cookie2.Expires = DateTime.Now.AddYears(-1)
Response.Cookies.Add(cookie2) 'Response.Cookies.Add(cookie2)
Response.Redirect("login/Logout.aspx") Response.Redirect("login/Logout.aspx")
End Sub End Sub