473,395 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Cookie Problems

I''m having a problem with cookies that is driving me insane :).
- If a user comes to http://domain.com and a cookie is set for them, then the user for whatever reason jumps to http://www.domain.com one of the 2 happens:

1) The cookie we set can not be read (expected), but then a new one can not be written ether (I looked at the server headers and although the cookie information is sent, IE ignores it).

2) The cookie from http://domain.com can be read, but you can not write to this cookie. Same here cookie is sent back from the server but IE ignores it.

Now, if its the other way around. If a user comes to http://www.domain.com, a cookie is set, then he/she jumps to http://domain.com:

The cookie can not be read (expected), but a new one can be written (as it should be).

So after driving my self insane, i whent out and tried it out in other servers to see if it was true. I tried 4 different sites which used cookies (for shopping carts). I did the same tests, (Go in via domain.com, add something to cart, then, jump to www.domain.com, cookie would not be overwritten. Then did the other way around, everything worked fine.)

Sample code:

cookietest.asp
------------------------------------------------------
<%

if request.querystring("action")="setcookie" then
Response.cookies("dog")=request.querystring("cooki eval")
response.cookies("dog").Expires = Date + 1
end if

if request.querystring("action")="readcookie" then
response.write "Cookie Value is: " & request.cookies("dog") & "<br><br>"

end if

%>

<a href="cookietest.asp?action=setcookie&cookieval=12 345">Set cookie</a>
¦
<a href="cookietest.asp?action=setcookie&cookieval=67 891">Set cookie2</a>
¦
<a href="cookietest.asp?action=readcookie">Read cookie</a>
<br><br><p>
-------------------------------------------

Visit: yourdomain.com/cookietest.asp
Set a cookie
Read it to make sure its there.
Now type in www.yourdomain.com/cookietest.asp
Read the cookie (anything set?)
Set a cookie (By my tests cookie is not written)

Try it the other way around and it works!

Please somone help me out here i need to know if its a browser issue, or just my sloppy code :)

-----------------------------
This message is posted by http://Asp.ForumsZone.com

Jul 19 '05 #1
0 2302

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: N.K | last post by:
Hi , Python's existing cookie module doesnt supports new cookie headers SetCookie2 , How to submit a patch for that ? I tried emailing person who owns that module.But no response. Thanks,...
1
by: HorseGeek | last post by:
I have three servers: Server1, Server2, and Server3. There is a login cookie does not expire for SOME users on Server2. Ironically, the login cookie expires correctly for ALL users on the...
7
by: What-a-Tool | last post by:
How does the expire date work setting it server side with asp. I know with javascript setting it client side it will be set to the clients local time, and therefore expire when the clients local...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.