再次发帖问:forms验证,为什么总是提前过期???????????????另再请"孟子"大哥进来解答!!!!!!!!!!大家请帮顶
先前的帖子:
http://community.csdn.net/Expert/topic/5135/5135340.xml
http://community.csdn.net/Expert/topic/5131/5131424.xml
最近找到的相同问题的帖子:
http://community.csdn.net/Expert/topic/4861/4861151.xml
http://topic.csdn.net/t/20051105/08/4373079.html
http://topic.csdn.net/t/20051102/20/4367545.html
代码:
//设置登陆信息
string Role="Administrator";//角色:管理员
//建立role-based认证票据
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1,Name,DateTime.Now,DateTime.MaxValue,false,Role);
//修改票据cookie,使其加密(本质是写入一个与票据cookie同名的新cookie)
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName,encryptedTicket);
Response.Cookies.Add(authCookie);
string url = "setup.aspx";
Response.Redirect(url);
难道这个问题大家都没解决???
孟子大哥,真的是这个问题吗?有没有好的解决方案啊?