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
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