Session.Abandon() can't logout

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I use the Login controls of Asp.net 2.0 in my program.
I want to logout a user by program, I try Session.Abandon() for this.
But I found that the user is the same after I execute Session.Abandon().

I thought that Session.Abandon() can break the connection of current user,
but I fail

How can I logout a user by program?
 
ad said:
I use the Login controls of Asp.net 2.0 in my program.
I want to logout a user by program, I try Session.Abandon() for this.
But I found that the user is the same after I execute Session.Abandon().

I thought that Session.Abandon() can break the connection of current user,
but I fail

How can I logout a user by program?

You would rather invoke
System.Web.Security.FormsAuthentication.SignOut().

Forms authentication uses cookies. This method will remove the cookie
from the browser.

I have barely touched ASP.NET 2.0 but this method is supported in both
framework 1.0, 1.1 and 2.0.

Correct me if I am wrong!
 
Never worked with ASP.NET but have 2 educated guesses where is the problem.

1. Session.Abandon only takes effect after page is completely executed. So the current page that called Abandon still has that same session. All next browser calls will be on a new Session

2. Is it possible that you are using AutoLogin feature. It will immediately log you back in as soon as you logout.


George.
I use the Login controls of Asp.net 2.0 in my program.
I want to logout a user by program, I try Session.Abandon() for this.
But I found that the user is the same after I execute Session.Abandon().

I thought that Session.Abandon() can break the connection of current user,
but I fail

How can I logout a user by program?
 
Thanks,
Your are correct!
SignOut() really can logout a user!

What about Session.Abadon()?
What dose it can do for us?
 
authenication and session are different. authenication is who the user is.
session is a way to attach server state information to a browser session.
they are indepentant of each other and neither requires the other.

so session abandon frees the session data only.

-- bruce (sqlwork.com)



session abandon, clears the session
 
Back
Top