VB.NET - session is not cleared after logout

Asked By muthu kumar
23-Dec-08 04:30 AM
end of post

TRY THIS  TRY THIS

23-Dec-08 05:15 AM

Solution:
The fix was simple.  I added an event handler to my LoginStatus control and wrote the code myself:

Master Page:
<asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="RedirectToLoginPage" OnLoggedOut="LoginStatus1_LoggedOut" />

Master Page Code-Beside:
protected void LoginStatus1_LoggedOut(object sender, EventArgs
e)
{   
      Session.Abandon();
}

Clear session values (VB.net)  Clear session values (VB.net)

23-Dec-08 05:15 AM

<%@ Page Language="vb" %>
<html>
   <head>
      <script runat="server">
         Sub Page_Load()
            Session.Clear()
            Message.Text = "There are " & Session.Count & _
               " items in the Session collection."
         End Sub
      </script>
   </head>
<body>
   <form runat="server">
      <asp:label id="Message" runat="server"/>
   </form>
</body>
</html>

TRY THIS LINK  TRY THIS LINK

23-Dec-08 05:18 AM
http://noesispedia.com/post/2008/09/11/Best-way-to-end-user-session-in-aspnet.aspx
reply  reply
23-Dec-08 05:25 AM
Session.Clear() just clears out the data in the session, but the session object is still there.  Session.Abandon() disposes the session and calls Session_End.
Try  adding this code to the mix

Response.Cache.SetCacheability(HttpCacheability.NoCache)


Response.Cache.SetExpires(DateTime.Now())

Re :: Session is not cleared after logout  Re :: Session is not cleared after logout
23-Dec-08 05:40 AM

Write the following code on the click event of your logout button or linkButton

Session("UserName") = ""
Session.Abandon()

It will clear the session.

Hope this helps.

re  re
23-Dec-08 06:28 AM

u look here for all possibility for session not cleared

http://www.eggheadcafe.com/community/aspnet/6/76968/session-not-getting-clear.aspx

use Session.Abandon() instead  use Session.Abandon() instead
23-Dec-08 07:29 AM

of Session.Clear. It will not cause End to fire and further requests from the client will not raise the Session Start event.

Check this article for more information:

http://msdn.microsoft.com/en-us/library/ms524310.aspx

 

Create New Account
help
Problems with FormsAuthentication in simple form Below is a very simple asp page that has a loginstatus control and button used to login the user in. The problem is I have to press the login button twice to get the loginstatus control to update. I even tried loginstatus.databind() in the button code but it didn't seem to matter. Obviously the login am I missing? thanks (posted on asp.net also but with no help offered) [CODE] <%@ Page Language = "C#" %> <!DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Transitional / / EN" "http: / / www.w3 org / TR / xhtml1 / DTD / xhtml1-transitional.dtd"> <script runat = "server"> protected void Button1_Click(object sender, EventArgs e) { if (Membership.ValidateUser("theuser", "thepassword")) { / / could have a profile option for remember me here true); } } < / script> <html xmlns = "http: / / www.w3.org / 1999 / xhtml" > <head runat = "server"> <title> Untitled Page< / title> < / head> <body> <form id = "form1" runat = "server"> <div> <asp:LoginName ID = "LoginName1" runat = "server" / > <asp:LoginStatus ID = "LoginStatus1" runat = "server" / > <asp:Button ID = "Button1" runat = "server" Text = "Button" OnClick = "Button1_Click" / > < / div
my website when i click signout in the menu. It should signout & navigate to login page and the back button should disable. I am using Master page and in the master page page load event i have written Response.Cache.SetNoStore(); ( to disable back button) But still the aspx"); Write this code in the page_load of logout.aspx protected void Page_Load( object sender, EventArgs e) { Session.Abandon(); Session.Clear(); Page.RegisterClientScriptBlock( "" , "<script> if(history.length> = 0)history.go(+1);< / script> " ); } Hello, Try to use following line on Login page PageLoad Event Page.Response.Cache.SetCacheability( HttpCacheability .NoCache); Hope this helpful! Thanks There is no logout page. logout
session login and logout as the default login page in asp.net 4.0 Hi!I want to get a page like the default login page in asp.net 4.0. or same thing like in yahoo I have a table Username password 123 788888 Admin admin123 124 783838 Daniel dan123 I have 4 pages (master page, Home page, login page and Menupage) on my home page I have something like this after start debugging WELCOME Cient: Log in Then once a user click on that Log in which is the loginstatus control the page will take him to login page where he will authenticate himself then
is blank ??? I have a standard Login ASP.NET 2.0 control on a login Page, a LoginName and LoginStatus controls on the member's page. once the user login successfully I am directing the user to Member.aspx page. You can see that in the code below.Also I am using form Authentication On 2005 ENABLE ANONMYOUS ACCESS IN IIS DISABLE WINDOWS AUTHENTICATION I am getting the following Output Page.User.Identity.Name: Page.User.Identity.IsAuthenticated: false Page.User.Identity.AuthenticationType: Is it something to do with Windows XP? or a IIS 5 0? Any help will be highly appreciated. Login.aspx file is <%@ Page Language = "C#" AutoEventWireup = "true" CodeFile = "Login.aspx.cs" Inherits = "Login" %> <!DOCTYPE html PUBLIC "- / / W3C / / DTD