我在使用表单身份验证故障单和Cookie正常工作时遇到了很多麻烦,因为现在我只是想知道在检查FireFox中的值时,cookie在firebug中看起来没有价值是否正常铬。这似乎不对,在我查看此代码后,cookie出现,但是为空。在此代码中,正确设置了sUserData。
我这样设置:
Dim sUserData As String = HttpContext.Current.Request.Cookies("UserID").Value & "|" &
HttpContext.Current.Request.Cookies("UserName").Value & "|" &
HttpContext.Current.Request.Cookies("UserEmail").Value
Dim fat As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, _
HttpContext.Current.Session("UserID"), DateTime.Now, _
DateTime.Now.AddDays(6), True, sUserData, _
FormsAuthentication.FormsCookiePath)
HttpContext.Current.Response.Cookies.Add(New HttpCookie(FormsAuthentication.FormsCookieName, _
FormsAuthentication.Encrypt(fat)))
答案 0 :(得分:2)
不,在使用Chrome时,我可以看到Cookie的价值。 我们试着做一个简单的检查。您是否可以首先尝试使用简单的键值对而不是FormAuthentication Ticket。