Writing cookies from ASP with spaces and hyphens

R

Robin Briggs

Hi.

I have an ASP (3.0, not .NET) app that writes cookies with hyphens and
spaces in the names and values. If I had the control over the apps that will
be looking for these cookies, I would eliminate the special characters, but
as it is, I do not have that luxury.

When I write the cookies, they seem okay in IE, but in Firefox, they are
strange. For example, the cookie name is US-NONUS, but in Firefox it looks
like US%2DNONUS. For a value of NEW HAMPSHIRE it comes out in Firefox as
NEW+HAMPSHIRE.

Please note that these strings are not created in any special way: They are
hard-coded into the ASP, with no encoding or anything like that.

Thoughts?

Thanks.
 
E

Evertjan.

Robin Briggs wrote on 06 mrt 2005 in
microsoft.public.inetserver.asp.general:
When I write the cookies, they seem okay in IE, but in Firefox, they
are strange. For example, the cookie name is US-NONUS, but in Firefox
it looks like US%2DNONUS. For a value of NEW HAMPSHIRE it comes out in
Firefox as NEW+HAMPSHIRE.

That would be nice new way of browswer detection, btw!

However, testing this in both Firefosx and IE shows it is not true:

======= test.asp =============

<%=request.cookies("test")%>

<%
response.cookies("test")="New Hampshire-Test"
%>

====================

Perhaps your <form method=..> is the culprit???
 
R

Robin Briggs

I think we are miscommunicating. I am talking about WRITING cookies. Has
nothing to do with reading them. Has nothing to do with the form submit.
Somewhere in the middle of several hundred lines of ASP code, I write
cookies that, when viewed in Firefox, show up with characters I did not use.

If you have any ideas, that would be appreciated.
 
E

Evertjan.

Robin Briggs wrote on 06 mrt 2005 in
I think we are miscommunicating. I am talking about WRITING cookies.
Has nothing to do with reading them. Has nothing to do with the form
submit. Somewhere in the middle of several hundred lines of ASP code,
I write cookies that, when viewed in Firefox, show up with characters
I did not use.

If you have any ideas, that would be appreciated.

[Please do not toppost. Topposting corrected]

Robin,

No miscommunication from this side, me thinks.

My test.asp above writes a cookie every time you press F5, and before it
writes the cookie, it reads the cookie that is written last F5 press.

The read cookie shows up as written in both browsers.

Of course you will have to read them in a test situation to see the
result.

[The <form > was just a suggestion as a probable source of the error]

Did you try to reproduce the error with my code? And what was the result?
 
B

Ben Strackany

Robin Briggs said:
I think we are miscommunicating. I am talking about WRITING cookies. Has
nothing to do with reading them. Has nothing to do with the form submit.
Somewhere in the middle of several hundred lines of ASP code, I write
cookies that, when viewed in Firefox, show up with characters I did not
use.

"When viewed in firefox" you mean via the cookie browser? If so, that
shouldn't matter -- firefox can store the cookies however it wants to. Some
browsers are going to encode the values. All you should worry about is that
your code, when reading the cookie value, gets the unencoded value (e.g.
"US-NONUS" instead of "US%2DNONUS") .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top