Storing information in a cookie
I want to store a string in a cookie but i can't get it working.
This is the script that works;
VB Code:
If Authenticated(txtuser.text,txtpass.text) then
Dim ticket as New FormsAuthenticationTicket( txtuser.text, checkbox1.checked, 50 )
Dim encTicket As String = FormsAuthentication.Encrypt(ticket)
Dim cookie as New HttpCookie(FormsAuthentication.FormsCookieName,encticket)
'cookie("diruser") = "testpod"
Response.Cookies.Add(cookie)
response.redirect("Corefile.aspx?action=summary")
else
Label1.text = "Bad username or Password"
end if
End Sub
But as soon as I un-comment the
cookie("diruser") = "testpod"
line the asp.net doesn't think the cookie is vaild and redirects the user to the login page.
My question is how do i store a value in a cookie and how to get it back?
Thanks