Special Characters in passed Query String

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sunshine Valdes

    Special Characters in passed Query String

    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(hexadeci mal) had a + in it.

    This is what is passed:


    but

    subnum = Request.QuerySt ring("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(Re cordset1.Fields .Item("rowid1") .Value) + "&vessrow=" +
    trim(Recordset1 .Fields.Item("r owid2").Value), "%20","") & """>") %>

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


    And the code that reads it:
    subnum = Request.QuerySt ring("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

    #2
    Re: Special Characters in passed Query String

    Use server.urlencod e() before appending the value to the querystring.




    "Sunshine Valdes" <sunshine.valde s@fwc.state.fl. us> wrote in message
    news:eJoyMtidDH A.3088@TK2MSFTN GP09.phx.gbl...[color=blue]
    > 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[/color]
    and[color=blue]
    > when the id number is click, you go to the details page. The records[/color]
    rowid[color=blue]
    > 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(hexadeci mal) had a + in it.
    >
    > This is what is passed:
    >[/color]
    http://servername/details.asp?privro...0000.0000.0000[color=blue]
    >
    > but
    >
    > subnum = Request.QuerySt ring("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(Re cordset1.Fields .Item("rowid1") .Value) + "&vessrow=" +
    > trim(Recordset1 .Fields.Item("r owid2").Value), "%20","") & """>") %>
    >
    > <%=(Recordset1. Fields.Item("li c_num").Value)% ></A>
    >
    >
    > And the code that reads it:
    > subnum = Request.QuerySt ring("privrow")
    >
    > I must add a side note, this is a site I have little experience with.[/color]
    I've[color=blue]
    > 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[/color]
    not[color=blue]
    > feasable at this time.
    >
    > Thanks for your time,
    > Sunshine
    >
    >
    >[/color]


    Comment

    • Adrienne

      #3
      Re: Special Characters in passed Query String

      Gazing into my crystal ball I observed "Sunshine Valdes"
      <sunshine.valde s@fwc.state.fl. us> writing in
      news:eJoyMtidDH A.3088@TK2MSFTN GP09.phx.gbl:
      [color=blue]
      > 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(hexadeci mal) had a + in it.
      >
      > This is what is passed:
      > http://servername/details.asp?privro...essrow=0000000
      > 0.0000.0000
      >
      > but
      >
      > subnum = Request.QuerySt ring("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(Re cordset1.Fields .Item("rowid1") .Value) + "&vessrow=" +
      > trim(Recordset1 .Fields.Item("r owid2").Value), "%20","") & """>") %>
      >
      ><%=(Recordset1 .Fields.Item("l ic_num").Value) %></A>
      >
      >
      > And the code that reads it:
      > subnum = Request.QuerySt ring("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
      >
      >
      >[/color]

      <%response.writ e("<A href=""details. asp?privrow=" & replace(trim
      (Recordset1.Fie lds.Item("rowid 1").Value) & "&vessrow=" & trim
      (Recordset1.Fie lds.Item("rowid 2").Value),"%20 ","") & """>") %><%=
      (Recordset1.Fie lds.Item("lic_n um").Value)%> </A>


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


      --
      Adrienne Boswell
      Please respond to the group so others can share

      Comment

      Working...