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