473,326 Members | 2,128 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,326 software developers and data experts.

Problem with querystrings and cookies

I've noticed a strange problem with setting cookies in ASP when the
cookie name you're setting exists in the querystring. The company I
work for has many partner sites who link to our site like this:
www.mycompany.com/partner.asp?PartnerID=??? The partner.asp page then
sets a cookie called PartnerID containing the value from the
querystring.

We have noticed, however, that if the partner calls the partner.asp
page and alters the capitalization of 'PartnerID' then another cookie
gets set which takes the capitalization of 'PartnerID' from the
querystring. All of the other asp pages in the site then seem to read
the first cookie set and thus it appears that the 'wrong' partner
settings are being used.

Has anyone experienced this problem before? Unfortunately altering the
cookie or querystring names would be a non-trivial task so this is not
an option at the moment.

Eifion
Jul 19 '05 #1
4 2326
How are you setting the cookie? Unless you're grabbing the name part from
the name/value pair in the querystring and using that as a cookie, the
cookie name will be whatever you set it as. Are you sure that you aren't
doing something like Request("partnerid") as opposed to
Request.QUERYSTRING("partnerid") or Request.COOKIES("partnerid")?

Ray at work

"Eifion" <ei**@btinternet.com> wrote in message
news:3f**************************@posting.google.c om...
I've noticed a strange problem with setting cookies in ASP when the
cookie name you're setting exists in the querystring. The company I
work for has many partner sites who link to our site like this:
www.mycompany.com/partner.asp?PartnerID=??? The partner.asp page then
sets a cookie called PartnerID containing the value from the
querystring.

We have noticed, however, that if the partner calls the partner.asp
page and alters the capitalization of 'PartnerID' then another cookie
gets set which takes the capitalization of 'PartnerID' from the
querystring. All of the other asp pages in the site then seem to read
the first cookie set and thus it appears that the 'wrong' partner
settings are being used.

Has anyone experienced this problem before? Unfortunately altering the
cookie or querystring names would be a non-trivial task so this is not
an option at the moment.

Eifion

Jul 19 '05 #2
Ray at <%=sLocation%> wrote:
How are you setting the cookie? Unless you're grabbing the name part from
the name/value pair in the querystring and using that as a cookie, the
cookie name will be whatever you set it as. Are you sure that you aren't
doing something like Request("partnerid") as opposed to
Request.QUERYSTRING("partnerid") or Request.COOKIES("partnerid")?


The code below reproduces the problem. If I go to
http://localhost/cookies.asp?Partner=ABC
I see 'Partner=ABC;' in the JavaScript cookie string. If I then go to
http://localhost/cookies.asp?Partner=DEF
then the cookie gets changed as expected. If I then try
http://localhost/cookies.asp?PArtner=GHI
then another Partner cookie gets appended to the querystring like this
Partner=DEF; ASPSESSIONIDSSAATSAT=LFFBLJKABHFOLLGDOCGOCKOI; PArtner=GHI

which gives two cookies with the same name (except for capitalisation).

Eifion

<%
strSource = Request.QueryString("Partner")
Response.Cookies("Partner") = strSource
%>
<Html>
<Head>
<Title></Title>
</Head>
<Body>
<script type="text/javascript">
document.write(document.cookie);
</script>
</Body>
</Html>
Jul 19 '05 #3
Although I never thought about if this would carry through to such code,
javascript is a case sensitive language. What are you doing with that
client side cookie code anyway?

Ray at work

"Eifion" <ei**@somedomainorother.yada> wrote in message
news:bo**********@hercules.btinternet.com...
Ray at <%=sLocation%> wrote:
How are you setting the cookie? Unless you're grabbing the name part from the name/value pair in the querystring and using that as a cookie, the
cookie name will be whatever you set it as. Are you sure that you aren't doing something like Request("partnerid") as opposed to
Request.QUERYSTRING("partnerid") or Request.COOKIES("partnerid")?


The code below reproduces the problem. If I go to
http://localhost/cookies.asp?Partner=ABC
I see 'Partner=ABC;' in the JavaScript cookie string. If I then go to
http://localhost/cookies.asp?Partner=DEF
then the cookie gets changed as expected. If I then try
http://localhost/cookies.asp?PArtner=GHI
then another Partner cookie gets appended to the querystring like this
Partner=DEF; ASPSESSIONIDSSAATSAT=LFFBLJKABHFOLLGDOCGOCKOI; PArtner=GHI

which gives two cookies with the same name (except for capitalisation).

Eifion

<%
strSource = Request.QueryString("Partner")
Response.Cookies("Partner") = strSource
%>
<Html>
<Head>
<Title></Title>
</Head>
<Body>
<script type="text/javascript">
document.write(document.cookie);
</script>
</Body>
</Html>

Jul 19 '05 #4
Nothing. The problem is that VBScript seems to get confused when reading
the cookies back on the server and sometimes gets the 'wrong' one when I
do a Request.Cookies("PartnerID"), ignoring the most recently set
partner cookie and choosing an earlier one.

Eifion

Ray at <%=sLocation%> wrote:
Although I never thought about if this would carry through to such code,
javascript is a case sensitive language. What are you doing with that
client side cookie code anyway?

Jul 19 '05 #5

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

Similar topics

2
by: Jan | last post by:
Hello, I'm builing a webstore with PHP. All products will be stored in a cookie-array. In the next page people could fill in their name, address etc. And in the 3rd page they could choose how...
1
by: duane | last post by:
Dear Experts: I have a problem with my JS cookies. I am setting cookies in files located in two different directories, e.g. one in ROOT, one in ROOT/dir1/dir2. The cookies are then sent to PHP...
2
by: Ian Sedwell | last post by:
Hi guys I've come across a problem with cookies. It seems that if one attempts to save several cookies in quick succession and then read them back again, you may attempt to read a cookie that...
0
by: Urban Bettag | last post by:
I want to use persistent cookies for my login page. For example, the user types in his username and password. He can check a box and the system should remember his username on a next visit. I have...
0
by: André | last post by:
Hi, I try to insert a graphic (bitmap) to the first file. No problem any more with that. But the graphic generated in the second file (graf2.aspx) must receive values from the the first file. I...
1
by: maheshv | last post by:
Hi all, Dear friends, i am facing a problem when using cookies i need help of yours... Lets come to the issue, i am using cookies all over the site, it is working all fine, the only problem is...
0
by: Jochen Hemberger | last post by:
Hello, I have a strange problem using cookies with my ASP.NET-App. I store some user settings in a cookie. The app is hosted on a server that is not in my domain but in a workgroup. Using...
3
by: nabira | last post by:
Hi, I've a problem with cookies for MediaWiki. I'm using: - Windows 2000 server machine as server. - Apache 2.0.61 as Web Server. - PHP 5.2.4 In particular, when I try to login from a client I...
3
by: sewen | last post by:
Dear all, I got a problem when i tried to access cookie in my project. There are 2 pages in the project:a.aspx and b.aspx. In a.aspx,i put the fololowing scripts: function SetCookie(name,value {...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.