473,395 Members | 1,678 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.

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 7185
you could read the folder name and then use that value to set the cookie.

"Alan Silver" <al*********@nospam.thanx> wrote in message news:f9**************@nospamthankyou.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*********@nospam.thanx> wrote in message
news:f9**************@nospamthankyou.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*********@nospam.thanx> wrote in message news:jl**************@nospamthankyou.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
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...
7
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...
9
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...
3
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...
5
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)...
1
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...
17
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...
29
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...
1
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...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.