473,748 Members | 4,067 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Aargh!! Cookie paths are case-sensitive!! How do you cope with THAT?

Hello,

I've just spent ages debugging some cookie code that wasn't working, and
have finally discovered that the code *was* working, but that the path
used by cookies is case-sensitive. I was setting a cookie for a path
like "/somepath", and trying to read it on a path like "/SomePath". This
was coming back as a non-set cookie.

So now I know what the problem is, I'm stuck with how to get around it.
In an ideal world, users would only ever click on links, not enter URLs
themselves, external sites wouldn't change the case of your URLs and so
on. Unfortunately, this isn't the case.

So, if a user enters http://domain/MyUrl/ and the cookie was set for
"/myurl", can I read it?

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #1
5 7262
you could read the folder name and then use that value to set the cookie.

"Alan Silver" <al*********@no spam.thanx> wrote in message news:f9******** ******@nospamth ankyou.spam...
Hello,

I've just spent ages debugging some cookie code that wasn't working, and have finally discovered that the code *was* working, but
that the path used by cookies is case-sensitive. I was setting a cookie for a path like "/somepath", and trying to read it on a
path like "/SomePath". This was coming back as a non-set cookie.

So now I know what the problem is, I'm stuck with how to get around it. In an ideal world, users would only ever click on links,
not enter URLs themselves, external sites wouldn't change the case of your URLs and so on. Unfortunately, this isn't the case.

So, if a user enters http://domain/MyUrl/ and the cookie was set for "/myurl", can I read it?

--
Alan Silver
(anything added below this line is nothing to do with me)

Nov 19 '05 #2
>you could read the folder name and then use that value to set the cookie.

The problem is reading the cookie, setting it is easy as I can just use
..ToLower() to make sure the cookie path is lowercase. If the URL in the
user's browser contains any uppercase letters, then I won't be able to
read the cookie. Short of redirecting to a lowercase version of the URL
(which has many side issues that I'd rather not handle), I can't see how
I can READ the cookie.

Thanks for the reply. Any further comments welcome.
"Alan Silver" <al*********@no spam.thanx> wrote in message
news:f9******* *******@nospamt hankyou.spam...
Hello,

I've just spent ages debugging some cookie code that wasn't working,
and have finally discovered that the code *was* working, but
that the path used by cookies is case-sensitive. I was setting a
cookie for a path like "/somepath", and trying to read it on a
path like "/SomePath". This was coming back as a non-set cookie.

So now I know what the problem is, I'm stuck with how to get around
it. In an ideal world, users would only ever click on links,
not enter URLs themselves, external sites wouldn't change the case of
your URLs and so on. Unfortunately, this isn't the case.

So, if a user enters http://domain/MyUrl/ and the cookie was set for
"/myurl", can I read it?

--
Alan Silver
(anything added below this line is nothing to do with me)



--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #3
if you read the folder name and assign it to a variable i believe it will retain the case. us ehte varible as part of the cookie
path and it should be the same , eh ?

=============== =============== ===========
And preachers also once said the world was flat ....
Nov 19 '05 #4
>if you read the folder name and assign it to a variable i believe it
will retain the case. us ehte varible as part of the cookie
path and it should be the same , eh ?


That still doesn't address the problem. Let me explain a little more..

Suppose a page sets a cookie for the path /somepath/ on the server.

Later on, the user comes back to the web site, but for some reason (of
which there are many), he access it via the URL
http://www.domain.com/SomePath/. The path /somepath/ does not match
/SomePath/, so the cookie is not read.

Sure I can read the current path, including the case of each letter, but
I need to know the case of the original path.

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #5
In this scenario, you'll have to create a comparison loop.

Get all the folders and compare them to the user's request in the same case . If a match is found, then use assign actual folder
name to a variable and use it, else, report no match found.

=============== =============== =============== ===============
"The highest courage is to dare to be yourself in the face of adversity.
Choosing right over wrong, ethics over convenience, and truth over
popularity.. These are the choices that measure your life. Travel the path
of integrity without looking back, for there is never a wrong time to do the
right thing."



"Alan Silver" <al*********@no spam.thanx> wrote in message news:jl******** ******@nospamth ankyou.spam...
if you read the folder name and assign it to a variable i believe it will retain the case. us ehte varible as part of the cookie
path and it should be the same , eh ?


That still doesn't address the problem. Let me explain a little more..

Suppose a page sets a cookie for the path /somepath/ on the server.

Later on, the user comes back to the web site, but for some reason (of which there are many), he access it via the URL
http://www.domain.com/SomePath/. The path /somepath/ does not match /SomePath/, so the cookie is not read.

Sure I can read the current path, including the case of each letter, but I need to know the case of the original path.

--
Alan Silver
(anything added below this line is nothing to do with me)

Nov 19 '05 #6

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

Similar topics

12
18013
by: chrism | last post by:
Hello, I have a pop-up window that I would like to appear in front of the browser home page when a user opens IE. Problem is, I'd like it to never appear again if the user navigates back to the home page during their time using the browser. However, if the user closes the browser, then reopens, the pop-up should appear again. (you may have guessed that this will be used for public access pc's.) I want to try as best I can to catch...
7
2145
by: Christoph Pieper | last post by:
Hi, we've the following problem : We have an asp-application which sets the cookie on first login. The cookie will never be touched during user access. The user can work the whole day, but after 6 to 7 hours, the cookie get 2-4 new asp-sessionid's thus overwriting the very first entries in the cookie. Does anyone had the same problem or has a solution. The server is a w2003 enterprise the client has windows xp sp2.
9
4500
by: Marco Krechting | last post by:
Hi All, I have a page with a list of hyperlinks. I want to save information in a cookie about the fact that I entered an hyperlink or not. When I click one of the hyperlinks I want this stored in a cookie and a small bullit shown in front of the hyperlink, so when I reload the page I can immediately see which hyperlinks I already visited that day.
3
11122
by: Wysiwyg | last post by:
After a server created cookie is processed on the client I want it removed, cleared, or expired in the javascript block but have been unable to do this. If I set a cookie value in the server code behind and don't use a domain then I can not change or remove that cookie's value on the client. If I subsequently create the cookie again in the codebehind then I actually end up with TWO cookies with the same name in the response. The cookie...
5
4873
by: Shane Thomas | last post by:
Hello, I'm having difficulty handling cookies with paths other than "/". An HttpWebRequest object returns these headers: Date: Tue, 26 Apr 2005 21:29:39 GMT Server: Apache/1.3.33 (Unix) PHP/4.3.10 Set-cookie: phpusid=12345; path=/; expires=Wednesday, 09-Nov-2008 23:12:40 GMT,data=deleted; expires=Mon, 26-Apr-2004 21:29:38 GMT; path=/stats; domain=www.somesite.com,data=deleted; expires=Mon, 26-Apr-2004 21:29:38 GMT;
1
6717
by: CR1 | last post by:
I found a great cookie script below, but don't know how to make it also pass the values sent to the cookie, to a querystring as well for tracking purposes. Can anyone help? If there was a way to simply pass the values in a cookie to the querystring that would be even easier, but from what I've been able to tell, cookie values can't be passed to a querystring. I'm sure the answer will help alot of others who are using this script, and would...
17
4178
by: Bruno | last post by:
I have a feature that is hosted on a different domain from the primary one in a frame, and need to retain values in a cookie. example: A web page at one.com contains a frame which has a page hosted at two.com If I view the frameset from one.com in Firefox, all works well with the content from two.com. But if trying to view this using IE (with standard security settings), the cookie set by two.com is not accessible.
29
3008
by: Jerim79 | last post by:
I did try to find the answer to this before posting, so this isn't a knee jerk reaction. What I am trying to accomplish is to have a script that opens a cookie, reads a value, and then use a switch/case to take action based on that value in the cookie. I want to set the cookie manually, so I don't need setcookie(). I see that in PHP it stores the cookie in memory. Is there a way to have PHP just read a cookie from the desktop machine?...
1
1822
by: fretIT | last post by:
Hello, when I write web method using C# in Visual basic 2005, I can't return the string value to the client request. I got such kind of error Not all code paths return a value. Don't know how to cope that problem. My code is as follow. Thanks in advance
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9324
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8243
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.