View Single Post
  #1 (permalink)  
Old May 5th, 2005, 01:33 PM
br_r14 br_r14 is offline
Registered User
Join Date: May 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cookie Updating in ASP.NET

I am currently working on a site coded in VB.NET that will take an existing cookie set under the default domain (i.e., save the values in the cookie, delete the original cookie* and rebuild the cookie with the site's primary domain (i.e.

*Using the below code to delete the cookie from the user's machine:
  Response.Cookies("myCookie").Expires = DateTime.Now.AddDays(-1)

I accomplish all of the above from within the Global.asax.vb file within the session_start method. The problem I'm experiencing is that, upon opening the site, the cookie is changed. However, in order for the controls accessing the cookie* to display properly, I must end the current session and reload the site.

*Accessing the cookie with the below code:
  If (Request.Cookies.Item("myCookie") Is Nothing = False) Then
    'control manipulation code
  End If

Is there a way around having to reload the session and have the new cookie under the primary domain be read 'on the fly' so to speak? Any help or references would be appreciated.

Reply With Quote