Special Characters in passed Query String

  • Thread starter Sunshine Valdes
  • Start date
S

Sunshine Valdes

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
 
A

Aaron Bertrand - MVP

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

Adrienne

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.
 

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

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top