var time = DateTime.Now.AddDays(14);
FormsAuthenticationTicket Ticket = new FormsAuthenticationTicket(1, "1", DateTime.Now, time, true, "normal", FormsAuthentication.FormsCookiePath);
string HashTicket = FormsAuthentication.Encrypt(Ticket);
HttpCookie UserCookie = new HttpCookie(FormsAuthentication.FormsCookieName, HashTicket);
UserCookie.Expires = Ticket.Expiration;
UserCookie.Path = Ticket.CookiePath;
Context.Response.Cookies.Add(UserCookie);
这是我登录的代码,在webservice中,方法名前加了 [WebMethod(EnableSession = true)],代码中的"1"是登录用户编号,现在的问题是不能实现两周免登录效果,浏览器关闭后重新打开,有时就又成未登录状态了,请问我的代码哪儿写的有问题?
慕村9548890
冉冉说
桃花长相依
慕斯709654
长风秋雁
阿晨1998
慕容708150
红颜莎娜