Session.Abandon() can't logout

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?
 
E

Emil Christopher Melar

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!
 
G

George

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?
 
A

ad

Thanks,
Your are correct!
SignOut() really can logout a user!

What about Session.Abadon()?
What dose it can do for us?
 
B

Bruce Barker

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top