Question

I am having a lot of trouble getting a Forms Authentication Ticket and Cookie to work properly , for right now I am just wondering if it is normal for the cookie to appear to have no value in firebug when inspecting the value in FireFox and Chrome. This doesn't seem right , after I go through this code the cookie appears , but is empty. In this code sUserData is properly set.

I set it like this :

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)))
Was it helpful?

Solution

No, while using Chrome I could see the value of cookie. Let's try doing a simple check. Could you first try for simple key value pair instead of FormAuthentication Ticket.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top