Cookies seem so simple...but

  • Thread starter Thread starter Keith-Earl
  • Start date Start date
K

Keith-Earl

I am developing on XP Pro VS.NET 2003. All cookie operations work well on
my dev box. When I publish to the PROD server (W2K .NET Framework 1.1) my
cookies do not behave the same way. Here is the code I write to
create/update the cookie:

Dim cookieCreate As New HttpCookie("myCookie")

cookieCreate.Values.Add("myVar", strmyVar)

cookieCreate.Expires = DateTime.MaxValue

Response.AppendCookie(cookieCreate)

cookieCreate = Nothing



What am I doing wrong? It seems so simple. When I try to read the cookie
back in the code is not finding it. I know I can tell my browser to reject
cookies, but I am browsing from the same PC. Code works great on DEV, not on
PROD.

How can I debug this situation?


I do not have access to the machine.config file on PROD.

Many thanks,

Keith
 
Most likely it's a browser issue if its the same code running on 2 different
sites.
Are you sure that a cookie is being set? And have you tried to locate the
cookie on your machine?

You can have an alert notice turned on when the browser is attempting to
create a cookie - easier in Netscape than IE.
Having that setting turned on should be very telling. Good luck.
 
Thanks, Peter. Yes, the cookie is definitlely being written on the dev box.
We are running IE 6 SP1 with all patches applied. When we browse the PROD
box with the same browser we don't get a cookie or I cannot locate it. I
even cleared all cookies to get one cookie: entry, but it never showed up.
Will try your trick, I know how to set it, select PROMPT instead of ALLOW or
BLOCK.

Thanks, and have a great weekend.

Keith
 
First thing, run Trace.axd and check the output page which creates the
cookie - see if you actually have created it.
Second, where are you reading it from? Create a read page and a write
page to test it. You can't read/write from the same page load.
 
You can do such task in IE, but in Netscape/Mozilla it's much more
straightforward and will also tell you all the details of the cookie being
set. Good luck.
 
Programmer, or should I say Tester error. On my desktop I had all my cookie
handling set appropriately. I had to test on my laptop (should have been
the same, but for some reason I had cookie handling set to BLOCK).

On the Privacy tab in IE under "Web Sites" I explicity set our PROD site to
accept cookies and viola!

Thanks and sorry to waste your time...
Keith
 
Back
Top