Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How can we terminate a user's session

Reply
Thread Tools

How can we terminate a user's session

 
 
ad
Guest
Posts: n/a
 
      08-12-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
 
      08-12-2005
"ad" <> wrote in message
news:...

> 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
 
      08-12-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" <> ¼¶¼g©ó¶l¥ó·s»D: bl...
> "ad" <> wrote in message
> news:...
>
>> 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
 
      08-13-2005
"ad" <> wrote in message
news:...

> 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

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 Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Terminate a VPN session Joe.Mobley@nationalexpress.com Cisco 5 12-22-2006 01:05 PM
Logoff and terminate an ASP.NET session? TR ASP .Net 6 02-09-2005 07:38 PM
How to terminate a telnet session from within your C/C++ program Michael C++ 1 01-27-2005 07:41 AM
terminate session? lucas ASP .Net 1 08-05-2004 06:16 PM
Can I terminate session programticly? feng ASP .Net 1 02-29-2004 04:41 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57