×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Query String parameter with spaces

Query String parameter with spaces

Query String parameter with spaces

(OP)
Hi

I am having a problem extracting query string parameter-values that contain spaces, eg

?param1=Value%20With%20Spaces

is coming out as

pvalue1 = Request.QueryString("param1")

pvalue is 'Value'

Any ideas?

RE: Query String parameter with spaces

Try
pvalue1 = Server.UrlDecode(Request("param1"))

________
George, M

RE: Query String parameter with spaces

(OP)
Didn't like URLDecode on the Server object (although it does appear to have a URLEncode method!)

RE: Query String parameter with spaces

I've mistaken ASP.NET with ASP.
You only have Server.URLEncode method not decode which is done automaticaly.
Anyway that is a strange thing. I never had this problem. The error must be somewhere else.
Can you post an ssimple code that gives you the error (i mean whole ASP code but a simple one who has same problem as your code).

________
George, M

RE: Query String parameter with spaces

(OP)
Sure.

At the top of the ASP page, I have the following bit of code:


<% archive = request.querystring("Archive")
  archUser = request.querystring("ArchUser")
  archDir = request.querystring("ArchDir")
  response.write "<input type=hidden id=archive value='" & archive & "'>"
  response.write "<input type=hidden id=archUser value='" & archUser & "'>"
  response.write "<input type=hidden id=archDir value='" & archDir & "'>"
  
%>


I then call the page passing in something like:

archDir=//dir/name%20with%20space

However, when I view the source, the value of the hidden field archDir is

//dir/name

RE: Query String parameter with spaces

Here it's my sample code
index.asp
<%
response.write Request("archDir")
%>
<input type=hidden

and in browser
index.asp?archDir=//dir/name%20with%20space

All were ok.

________
George, M

RE: Query String parameter with spaces

mmmmm, just maybe jby1 is using the Request.QueryString("param1") directly as a value in an input box? . . . and there are no quotes around?


<input type=text value=" &_
 Request.QueryString("param1") &_
 ">"

instead of

<input type=text value=""" &_
 Request.QueryString("param1") &_
 """>"



???


hth,
Foxbox



RE: Query String parameter with spaces

(OP)
It was caused by incorrect quotes elsewhere in the code.  I have no fixed it.

Thank you for your help!

RE: Query String parameter with spaces

Try to use " instead of ' in your Response.Write lines

 response.write "<input type=hidden id=archive value=""" & archive & """>"

________
George, M

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close