Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic Logout?

Status
Not open for further replies.

CharlieIT

MIS
Apr 9, 2003
157
US
I am looking for a way to automatically log-out a remote session from ASP.NET.

Example:

1. User#1 logs in to ASP.NET.
2. User#1 goes to a DIFFERENT computer and tries to login as the same user.

I want IIS to prompt the user telling them they are already logged in to another session and give the user the option of automatically logging off the first session.

Is this doable? If so, can you point me to an excellent resource to figure out how to do it?

Thanks!
 
Are you using anonymous access to this site through IIS? If you are, IIS will not be able to tell the difference between two completely seperate users - To IIS, all users belong to the ASP.NET account(I think ;)).

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Hey Charlie,

Actually its pretty easy to do.

All you need to do is, when the user logs in initially, write a record to the database. This record will include whatever sort of ID you're using to identify the user, and the session ID (which you can get by going session.sessionID).

Then, whenever someone logs in, you can do a check in the database for the user. If he's logged in already, you just need to have code in the login page to alert the user and stop access to the site.

In the Global.asax file, on the Session_End, have code that will take the SessionID and delete the record from teh database, as well as code that will do the same wherever you have the logout code (if you have a logout method).

Voila! Thats how we kept track of who was logged in during a prior project.

hth

D'Arcy
 
D'Arcy:

Instead of figuring out a way to force this to work the way that I thought it should, you helped me to simplify my methodology and let this work the way that it was meant.

In other words--thank you.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top