Manually created Cookie with UserData won't persist

M

mitch

I'm manually creating a FormsAuthenticationTicket and adding userdata.
The problem is that the cookie won't persist.

Code:
--------------------------------------------------------------------
Dim isPersistent As Boolean = Remember.Checked
Dim userData As String = "RecordNumber"

Dim ticket As New FormsAuthenticationTicket(1,strEmail,System.DateTime.Now,System.DateTime.Now.AddMinutes
(30),isPersistent,userData,FormsAuthentication.FormsCookiePath())

' Encrypt the ticket.
Dim encTicket As String = FormsAuthentication.Encrypt(ticket)

' Create the cookie.
Dim authCookie as New
HttpCookie(FormsAuthentication.FormsCookieName(), encTicket)
authCookie.Path = FormsAuthentication.FormsCookiePath()
If isPersistent = True
Then authCookie.Expires = DateTime.Now.AddYears(50)
End If

'Write the cookie
Response.Cookies.Add(authCookie)
----------------------------------------------------------------------

I have another application (same client/server setup) that uses:
FormsAuthentication.RedirectFromLoginPage(Email.Text,
Remember.Checked)
and this cookie persists fine.....

Using IE6 and W2K server.

Thanks

Mitch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top