473,811 Members | 3,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2356
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("partne rid") as opposed to
Request.QUERYST RING("partnerid ") or Request.COOKIES ("partnerid" )?

Ray at work

"Eifion" <ei**@btinterne t.com> wrote in message
news:3f******** *************** ***@posting.goo gle.com...
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("partne rid") as opposed to
Request.QUERYST RING("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; ASPSESSIONIDSSA ATSAT=LFFBLJKAB HFOLLGDOCGOCKOI ; PArtner=GHI

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

Eifion

<%
strSource = Request.QuerySt ring("Partner")
Response.Cookie s("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**@somedomai norother.yada> wrote in message
news:bo******** **@hercules.bti nternet.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("partne rid") as opposed to
Request.QUERYST RING("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; ASPSESSIONIDSSA ATSAT=LFFBLJKAB HFOLLGDOCGOCKOI ; PArtner=GHI

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

Eifion

<%
strSource = Request.QuerySt ring("Partner")
Response.Cookie s("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
1735
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 they will pay. These data will also be stored in an array. In the 4th page they could see a complete list of al the information they filled in. I think some of you know my problem: you could only use 20 cookies, the 21th will overwrite another used...
1
2503
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 file (server-side) which writes their values to a textfile, e.g. OUT.txt. The cookies that are in ROOT are working perfectly. No problem. The cookies set in ROOT/dir1/dir2, however, "seemed" to be set and read correctly, although
2
1388
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 has not yet been saved from the first operation. I assume that this is because JavaScript via the browser hands the job over to the OS and then merrily proceeds upon its way. As it happens, I solved the problem by rewriting my code to use one...
0
319
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 the following code, generating and reading the cookie seems to work fine. If I uncheck the box, the cookie should be removed or reset. For some reason, the cookie will not be changed and remains in the cookie folder (C:\Document and...
0
898
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 do that with cookies. It works when i send ONE cookie, but if i send two cookies from the first file, i get the browser-error: "can't render the page (or something like that) ... check your configuration etc ...".
1
1181
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 that the cookies gets expire after 1-2 hours of login, even when i am active for almost all the time. Here is the code what i have used to create a cookie at the time of login:- setcookie("logged_persid", "$PersId", 0, "/"); Can anyone suggest...
0
259
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 Firefox everything is fine. But with IE the cookie is not availlable. Same behavior with session state. I've set up IE to accept all cookies. But anyway it wouldn't work. If I host the APP on my own workstation it works. Locally on the other workstation...
3
4517
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 can't do it. I have an error message like this: "Logon Error: Access to my_web_site needs cookies been enabled in your browser".
3
1494
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 { var Days = 30; var exp = new Date(); exp.setTime(exp.getTime() + 24*60*60*1000); document.cookie = name + "="+ escape (value) + ";expires=" +
0
9730
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10392
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10403
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
9208
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...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5555
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...
1
4341
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
3
3020
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.