//创建一个登录码,更新数据表并写入cookie
string _UserCurrentLoginCode = Guid.NewGuid().ToString();
//将生成登录号写进数据库
SiteUser.UpdateUserCurrentLoginCode(_Id, _UserCurrentLoginCode);
System.Web.HttpContext _HttpContext = System.Web.HttpContext.Current;
_HttpContext.Response.Cookies["UserCurrentLoginCode"].Value = _UserCurrentLoginCode;
//判定
if (Request.Cookies["UserCurrentLoginCode"] != null)
{
string currentUserCurrentLoginCode = Request.Cookies["UserCurrentLoginCode"].Value;
string oldUserCurrentLoginCode = 数据库中取得当前用户的过去登录(未注销)号
if (oldUserCurrentLoginCode.Length > 0 && oldUserCurrentLoginCode != currentUserCurrentLoginCode)
{
FormsAuthentication.SignOut();
Response.Redirect("ManageMessage.aspx");--提示信息页(您的账号在别处登录,退出当前登录)
}
}