In login.aspx:
protected void Login1_LoggedIn(object sender, EventArgs e)
{
string sKey = Login1.UserName;
string sValue = Session.SessionID;
Session[sKey] = sValue;
TimeSpan SessTimeOut = new TimeSpan(0, 0, HttpContext.Current.Session.Timeout, 0, 0);
HttpContext.Current.Cache.Insert(sKey, sValue, null, DateTime.MaxValue, SessTimeOut,
System.Web.Caching.CacheItemPriority.NotRemovable, null);
}
In Master Page of admin:
protected void Page_Load(object sender, EventArgs e)
{
string sValue = Cache[HttpContext.Current.User.Identity.Name].ToString();
if (Session.SessionID != sValue)
{
FormsAuthentication.SignOut();
Response.Redirect("login.aspx");
}
}
http://stackoverflow.com/questions/2025908/avoid-concurrent-login-logout-former-login-session-in-asp-net-membership
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment