froms 验证如果关闭浏览器登录就失效啊?
里面只有设置时间长短的啊
FormsAuthenticationTicket Ticket = new FormsAuthenticationTicket(
1,
UserName,
DateTime.Now,
DateTime.Now.AddDays(1), // Add(System.TimeSpan.FromMinutes(30)),
false,
Customer,
FormsAuthentication.FormsCookiePath);
第4个参数该如何设????
呵呵这个啊你可以把验证信息保存在Cookie里啊看看我的文章 吧过来,先给你一点点提示
//创建一个验证票据
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, txtName.ToString().Trim(), DateTime.Now,
DateTime.Now.AddMinutes(30), true, "User");
//并且加密票据
string cookieStr = FormsAuthentication.Encrypt(ticket);
//创建cookie
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, cookieStr);
////保存密码 在这里可以不保存密码
//设置cookie有效期
cookie.Expires = ticket.Expiration;
//cookie存放路径
cookie.Path = FormsAuthentication.FormsCookiePath;
//添加到Cookies集合中
Response.Cookies.Add(cookie);
http://www.cnblogs.com/sufei/archive/2009/05/15/1485981.html原文章