关于session丢失或错乱的问题
asp.net 2.0 IIS 5.1环境
使用session保存用户信息
一台客户端先登录甲用户,另一台客户再登录乙用户,此时,第一台客户端操作时session丢失而退到登录界面(也可能session中的内容不对引起的),_userID在用户登录时赋初值。
private static long _userID = -1;
public static bool CheckLogin()
{
long uid = -2;
try
{
uid = (long)HttpContext.Current.Session[userKey];
}
catch
{
return false;
}
if (uid != _userID)
{
return false;
}
return true;
}