Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Manually created Cookie with UserData won't persist

Reply
Thread Tools

Manually created Cookie with UserData won't persist

 
 
mitch
Guest
Posts: n/a
 
      03-04-2004
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.DateTi me.Now,System.DateTime.Now.AddMinutes
(30),isPersistent,userData,FormsAuthentication.For msCookiePath())

' 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.Te xt,
Remember.Checked)
and this cookie persists fine.....

Using IE6 and W2K server.

Thanks

Mitch
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to persist event handlers for dynamically created web controls Dica ASP .Net 1 06-20-2007 03:04 PM
Can't persist the cookie JimFoye ASP .Net Security 3 01-26-2005 10:01 PM
Does session cookie persist when after session times out? =?Utf-8?B?RWFybCBUZWlncm9i?= ASP .Net 2 07-28-2004 06:42 PM
cookie don't persist aftes server.transfer Hernán Castelo ASP General 4 06-03-2004 02:29 PM
authentication cookie not persist BH ASP .Net 2 08-14-2003 04:12 AM



Advertisments