PC Review


Reply
Thread Tools Rate Thread

How can we terminate a user's session

 
 
ad
Guest
Posts: n/a
 
      12th Aug 2005
In some condition, like another user log in with the some ID, I want to
close a user's session.
How can we terminate a user's session with program?


 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      12th Aug 2005
"ad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> In some condition, like another user log in with the some ID, I want to
> close a user's session.
> How can we terminate a user's session with program?


See my earlier reply about session timeout - basically, you can't...

Remember that IIS sessions are by definition independent of each other so,
unless you record each successful login in something like SQL Server, one
session can't have any knowledge about any other session.

However, if you do log each successful login, you could very simply add code
to the OnInit of each ASPX's code-behind which did something like:

if(<some condition fetched from SQL Server>)
{
Session.Abandon();
}


 
Reply With Quote
 
ad
Guest
Posts: n/a
 
      12th Aug 2005
Thanks for your immediately answer.
But I want close specific session, not the session right now.
My scenario:
I prepare a database table (name UserOnLine) to log the User ID and Session
ID of user.

When a use login with a ID (Say User1) I check the UserOnLine table, If
there no User1 in the UserOnLine table, run the common login process.
But if the User1 ID already in UserOnLine table:
1. Fetch the SessionID of User1 in UserOnLine table.
2. Abandon the Session of that SessionID
3. Process common login process.

My question is :
1. How to get the session ID when a user login?
2. How can we abandon a specific session?



"Mark Rae" <(E-Mail Removed)> ¼¶¼g©ó¶l¥ó·s»D:(E-Mail Removed)...
> "ad" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>> In some condition, like another user log in with the some ID, I want to
>> close a user's session.
>> How can we terminate a user's session with program?

>
> See my earlier reply about session timeout - basically, you can't...
>
> Remember that IIS sessions are by definition independent of each other so,
> unless you record each successful login in something like SQL Server, one
> session can't have any knowledge about any other session.
>
> However, if you do log each successful login, you could very simply add
> code to the OnInit of each ASPX's code-behind which did something like:
>
> if(<some condition fetched from SQL Server>)
> {
> Session.Abandon();
> }
>



 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      13th Aug 2005
"ad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> 1. How to get the session ID when a user login?


HttpContext.Current.Session.SessionI

> 2. How can we abandon a specific session?


Don't even try - rethink your application design...


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to automatically terminate an open session =?Utf-8?B?U3RldmU=?= Microsoft Windows 2000 Networking 1 15th Nov 2006 06:16 PM
Logoff and terminate an ASP.NET session? TR Microsoft ASP .NET 6 9th Feb 2005 08:38 PM
terminate session? lucas Microsoft ASP .NET 1 5th Aug 2004 07:16 PM
Can I terminate session programticly? feng Microsoft ASP .NET 1 29th Feb 2004 05:41 PM
How to terminate a Session in Global.asax? Denon Microsoft ASP .NET 1 13th Nov 2003 11:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:39 PM.