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();
> }
>
|