Reputation: 37
I want to kill session on another machine if the new session started with the same username as the username in a session that running on another machine,i`m storing the 'username's and sessions id as applications variables and deleting them when session over
Sesion_Start()
if (Application[Session["Username"].ToString()] != null)
{ string id = Application[Session["Username"].ToString()].ToString(); //kill the session Application[Session["Username"].ToString()] = HttpContext.Current.Session.SessionID; else Application[Session["Username"].ToString()] = HttpContext.Current.Session.SessionID;
Session_End()
Application[Session["Username"].ToString()] = null;
So Bassicly,what i left it`s find session in some session collection and kill it,anyone have ideas how to do it?
Upvotes: 0
Views: 291
Reputation: 6814
Store session data on a database server by changing the mode attribute to SqlServer
<sessionState mode="SqlServer"
sqlConnectionString="data source=127.0.0.1;user id=sa; password="
cookieless="false" timeout="20" />
then query the session database
select SessionItemShort,
SessionItemLong
from ASPStateTempSessions
Upvotes: 1