Special Characters in passed Query String

Discussion in 'ASP General' started by Sunshine Valdes, Sep 8, 2003.

  1. Hello all. I am a very new ASP programmer and am having problems with a
    special character in a query string. The first pages pulls up a record and
    when the id number is click, you go to the details page. The records rowid
    is passed to the second page and then the database is requeried for the
    detail results. We came across this problem when a rowid in
    Oracle(hexadecimal) had a + in it.

    This is what is passed:
    http://servername/details.asp?privrow=AAAKN/ADjAAAM8CAA &vessrow=00000000.0000.0000

    but

    subnum = Request.QueryString("privrow") = AAAKN/ADjAAAM8CAA not
    AAAKN/ADjAAAM8CAA+

    At this point I get rowid invalid.

    Here is the code that creates the string:
    response.write("<A href=""details.asp?privrow=" &
    replace(trim(Recordset1.Fields.Item("rowid1").Value) + "&vessrow=" +
    trim(Recordset1.Fields.Item("rowid2").Value),"%20","") & """>") %>

    <%=(Recordset1.Fields.Item("lic_num").Value)%></A>


    And the code that reads it:
    subnum = Request.QueryString("privrow")

    I must add a side note, this is a site I have little experience with. I've
    inherited it with these problems and must just apply a fix and not a
    rewrite. I know there is probably a better way to handle this but it's not
    feasable at this time.

    Thanks for your time,
    Sunshine
     
    Sunshine Valdes, Sep 8, 2003
    #1
    1. Advertising

  2. Use server.urlencode() before appending the value to the querystring.




    "Sunshine Valdes" <> wrote in message
    news:...
    > Hello all. I am a very new ASP programmer and am having problems with a
    > special character in a query string. The first pages pulls up a record

    and
    > when the id number is click, you go to the details page. The records

    rowid
    > is passed to the second page and then the database is requeried for the
    > detail results. We came across this problem when a rowid in
    > Oracle(hexadecimal) had a + in it.
    >
    > This is what is passed:
    >

    http://servername/details.asp?privrow=AAAKN/ADjAAAM8CAA &vessrow=00000000.0000.0000
    >
    > but
    >
    > subnum = Request.QueryString("privrow") = AAAKN/ADjAAAM8CAA not
    > AAAKN/ADjAAAM8CAA+
    >
    > At this point I get rowid invalid.
    >
    > Here is the code that creates the string:
    > response.write("<A href=""details.asp?privrow=" &
    > replace(trim(Recordset1.Fields.Item("rowid1").Value) + "&vessrow=" +
    > trim(Recordset1.Fields.Item("rowid2").Value),"%20","") & """>") %>
    >
    > <%=(Recordset1.Fields.Item("lic_num").Value)%></A>
    >
    >
    > And the code that reads it:
    > subnum = Request.QueryString("privrow")
    >
    > I must add a side note, this is a site I have little experience with.

    I've
    > inherited it with these problems and must just apply a fix and not a
    > rewrite. I know there is probably a better way to handle this but it's

    not
    > feasable at this time.
    >
    > Thanks for your time,
    > Sunshine
    >
    >
    >
     
    Aaron Bertrand - MVP, Sep 8, 2003
    #2
    1. Advertising

  3. Sunshine Valdes

    Adrienne Guest

    Gazing into my crystal ball I observed "Sunshine Valdes"
    <> writing in
    news::

    > Hello all. I am a very new ASP programmer and am having problems with
    > a special character in a query string. The first pages pulls up a
    > record and when the id number is click, you go to the details page.
    > The records rowid is passed to the second page and then the database is
    > requeried for the detail results. We came across this problem when a
    > rowid in Oracle(hexadecimal) had a + in it.
    >
    > This is what is passed:
    > http://servername/details.asp?privrow=AAAKN/ADjAAAM8CAA &vessrow=0000000
    > 0.0000.0000
    >
    > but
    >
    > subnum = Request.QueryString("privrow") = AAAKN/ADjAAAM8CAA not
    > AAAKN/ADjAAAM8CAA+
    >
    > At this point I get rowid invalid.
    >
    > Here is the code that creates the string:
    > response.write("<A href=""details.asp?privrow=" &
    > replace(trim(Recordset1.Fields.Item("rowid1").Value) + "&vessrow=" +
    > trim(Recordset1.Fields.Item("rowid2").Value),"%20","") & """>") %>
    >
    ><%=(Recordset1.Fields.Item("lic_num").Value)%></A>
    >
    >
    > And the code that reads it:
    > subnum = Request.QueryString("privrow")
    >
    > I must add a side note, this is a site I have little experience with.
    > I've inherited it with these problems and must just apply a fix and not
    > a rewrite. I know there is probably a better way to handle this but
    > it's not feasable at this time.
    >
    > Thanks for your time,
    > Sunshine
    >
    >
    >


    <%response.write("<A href=""details.asp?privrow=" & replace(trim
    (Recordset1.Fields.Item("rowid1").Value) & "&vessrow=" & trim
    (Recordset1.Fields.Item("rowid2").Value),"%20","") & """>") %><%=
    (Recordset1.Fields.Item("lic_num").Value)%></A>


    Replace the + with & . IIRC + is for javascript.


    --
    Adrienne Boswell
    Please respond to the group so others can share
    http://www.arbpen.com
     
    Adrienne, Sep 11, 2003
    #3
    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. SMG
    Replies:
    20
    Views:
    16,061
    =?Utf-8?B?TWF2ZXJpY2s=?=
    May 25, 2005
  2. SMG - Idealake

    Special Characters in Query String

    SMG - Idealake, May 20, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    17,985
    Juan T. Llibre
    May 20, 2005
  3. Stefan Mueller
    Replies:
    3
    Views:
    33,043
    Stefan Mueller
    Jul 23, 2006
  4. Replies:
    2
    Views:
    1,095
    Ingo Menger
    May 31, 2007
  5. Sobin Thomas
    Replies:
    5
    Views:
    829
    Mike Brind [MVP]
    May 21, 2008
Loading...

Share This Page