I am currently working on a site coded in VB
.NET that will take an existing cookie set under the default domain (i.e. something.google.com), save the values in the cookie, delete the original cookie* and rebuild the cookie with the site's primary domain (i.e. google.com).
*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
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.