Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cookie issue

Status
Not open for further replies.

mwa

Programmer
Jul 12, 2002
507
US
Hey Cookie Monsters...

Say, I have a directory called
In which, I have a page called process.asp that writes a cookie:

Response.Cookies("UserID") = user
Response.Cookies("UserID").expires = date() + 1

Then I have another page in the same directory, called close.asp which contains:

user = lcase(Request.Cookies("UserID"))

How come I can not get the cookie on the second page? I get no errors and I have confirmed that the cookie was written in the first page.

I have used the code below to loop through the cookie collection and the cookie is not listed:

for each cookie in Request.Cookies
Response.Write (cookie & &quot; = &quot; & Request.Cookies(cookie) & &quot;<BR>&quot;)
next

Other cookies are listed but not the one that I want. Any ideas???

Thanks,
mwa
 
Oh by the way...

One thing that I have noticed is that on my cookie (the one that does not show up in the 'for-next') it has this:

UserID[]MWATEN[]domain.com/applications

One of the cookies that does show up looks like this:

Vacancy[]10%2F23%2F2002+4%3A38%3A22+PM[]domain.com/

([] represents the tab character)

Notice mine has &quot;applications&quot; in it and the other does not...Could this be part of the probleM???



 
Trying to remember cookies but shouldnt it be like this

Response.Cookies(&quot;MyCookieName&quot;)(&quot;UserID&quot;) = user
Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
Yeah... You can do it that way if you want to give one cookie multiple values... Kind of like an array. Or you can do it the way I've got it... I've tried both with the same results...
 
I'm not sure, but it could be worth checking that
Code:
date()+1
gives the wanted result (1 day).
I would try setting the &quot;expires&quot; property to a fixed date and see if the problem is still there.
I assume the cookie has your domain name in it and not &quot;domain.com&quot;?
 
gny - I just tried setting the .expires to &quot;12/31/2003&quot; but it still does not work. Also, you assumed right about the domain name.

Any other ideas???
 
Anybody else have any ideas??????
 
I'm not very good at cookies but I would try to isolate the problem. Do you set the domain and path attributes? Try not to and see what happens. Or try changing the path property.=)
Sorry if I'm not being much help...
 
I appreciate the help...

I have tried numerous combinations trying to isolate the problem, as you suggested... Still no luck...

I finally have resorted to just having the user key in their userid into a textbox in order to get over this problem...

It's probably something simple that I'm overlooking... But such is life...

mwa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top