Writing cookies from ASP with spaces and hyphens

Discussion in 'ASP General' started by Robin Briggs, Mar 6, 2005.

  1. Robin Briggs

    Robin Briggs Guest

    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.
     
    Robin Briggs, Mar 6, 2005
    #1
    1. Advertising

  2. Robin Briggs

    Evertjan. Guest

    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???

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Mar 6, 2005
    #2
    1. Advertising

  3. Robin Briggs

    Robin Briggs Guest

    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.

    "Evertjan." <> wrote in message
    news:Xns9611B2142DFDEeejj99@194.109.133.29...
    > 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???
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Replace all crosses with dots in my emailaddress)
    >
     
    Robin Briggs, Mar 6, 2005
    #3
  4. Robin Briggs

    Evertjan. Guest

    Robin Briggs wrote on 06 mrt 2005 in
    > "Evertjan." <> wrote in message
    >> Robin Briggs wrote on 06 mrt 2005 in
    >>
    >>> 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???


    > 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?

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Mar 6, 2005
    #4
  5. "Robin Briggs" <> wrote in message
    news:...
    > 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") .

    --
    Ben Strackany
    www.developmentnow.com
     
    Ben Strackany, Mar 9, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Harris
    Replies:
    46
    Views:
    1,059
    Ronald Landheer-Cieslak
    Jul 23, 2004
  2. cmd_17
    Replies:
    0
    Views:
    493
    cmd_17
    Oct 15, 2007
  3. Dylan Parry

    Hyphens and IE, an observation

    Dylan Parry, Oct 25, 2007, in forum: HTML
    Replies:
    26
    Views:
    1,425
    Nick Theodorakis
    Oct 27, 2007
  4. _Who
    Replies:
    7
    Views:
    2,721
  5. johkar
    Replies:
    2
    Views:
    2,960
    Mayeul
    Dec 10, 2009
Loading...

Share This Page