标签:
dtcms安全退出:
Session[DTKeys.SESSION_ADMIN_INFO] = null;
Utils.WriteCookie("AdminName", "DTcms", -14400);
Utils.WriteCookie("AdminPwd", "DTcms", -14400);
Response.Redirect("login.aspx");
过程:清空session,设置cookie过期
public static void WriteCookie(string strName, string strValue, int expires)
{
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
if (cookie == null)
{
cookie = new HttpCookie(strName);
}
cookie.Value = UrlEncode(strValue);
cookie.Expires = DateTime.Now.AddMinutes(expires);
HttpContext.Current.Response.AppendCookie(cookie);
}
而登陆时流程是:存session,写入日志,写入cookie
标签:
原文地址:http://www.cnblogs.com/ytup/p/5747933.html