p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   Cookie Updating in ASP.NET (http://p2p.wrox.com/showthread.php?t=28982)

br_r14 May 5th, 2005 01:33 PM

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. 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)
  Response.Cookies.Add(Request.Cookies("myCookie"))

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.


mat41 May 5th, 2005 06:55 PM

This is the classic ASP area of the forum - try the .net area.

Wind is your friend
Matt


All times are GMT -4. The time now is 11:48 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.