asp.net mvc close previous session for same user -
hi need close previous session same user. if user logon on computer , logon on b must close session a. have no ideas :( lot.
start new session
session.abandon();
and depending on inner workings of application logout user. of course not needed if store logged in user in session. abandoned first call anyway.
edit
if need access other sessions of same user have resort other session state modes inproc. in case db state mode trick. check msdn resource it.
you have create separate table like:
create table usersession ( userid int not null references dbo.user(userid), sessionid varchar(100) not null, primary key (userid, sessionid) ) go
when user logs in have to:
- update usersession tabel , either remove existing user sessions.
- add current session.
when user logs out remove record usersession
table.
you have custom ihttpmodule
authentication. particular module should check whether record exists current session. if doesn't should logout user , redirect page says you've logged in @ other place.
table comment: every user can have several sessions in table since may disconnected or may close browsers before logging out. hence primary key on both fields.
Comments
Post a Comment