2
我创建使用窗体身份验证, 我的网站登录,我不明白为什么创造了机票,将它添加到饼干后为什么后验证是假HttpContext.Current.Request.IsAuthenticated
如果我检查HttpContext.Current.Request.IsAuthenticated
我得到错误。只有在连续请求的用户成为身份验证
这是我的代码
var fat = new FormsAuthenticationTicket(
1,
username,
DateTime.Now,
DateTime.Now.AddMinutes(20),
rememberMe,
contact.Id + "," + contact.Role.Id,
FormsAuthentication.FormsCookiePath);
HttpContext.Current.Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(fat)));
在这一点上,如果我检查HttpContext.Current.Request.IsAuthenticated我得到假的,我想到了这点用户认证...
这是我的配置
<authentication mode="Forms">
<forms loginUrl="/Admin/Login.aspx" name="FormAuthentication" />
</authentication>
<authorization>
<deny users="?"/>
</authorization>
感谢。
五个问题,不接受。不太好!! – 2011-04-11 06:38:17