Query string in asp page

D

Don Grover

In asp how How can i pass a parameter value with a space in the value

like this

test.asp?catalog=aValue&lineitem=ladies cloths

I get a %20 as a space in the browser window,
Regards
Don
 
K

Kai Boenke

Gram wrote:
[snip replace function]
The replace function here removes any '%20' it finds and replaces it with a
space

This won't work due to the nature of the HTTP standard (should be
somewhere within RFC 2616).
Because a http query string cannot contain spaces within a request
(blanks are userd as separators f.ex. "GET index.html") they are being
replaced by your browser automatically. Therefore some kind of
server-sided replace function will not work - and even should not work.
However, your webserver knows about this and replaces all %20 with
spaces so you can access your variables again with spaces instead of %20.

This does affect other special characteres as well. There is a
server-function that you can use to encrypt a string before processing
your document to the client: Server.HTMLencode (SomeString)
 
R

Ray at

Or Server.URLEncode(SomeString)

Ray at home

Kai Boenke said:
Gram wrote:
[snip replace function]
The replace function here removes any '%20' it finds and replaces it with a
space

This won't work due to the nature of the HTTP standard (should be
somewhere within RFC 2616).
Because a http query string cannot contain spaces within a request
(blanks are userd as separators f.ex. "GET index.html") they are being
replaced by your browser automatically. Therefore some kind of
server-sided replace function will not work - and even should not work.
However, your webserver knows about this and replaces all %20 with
spaces so you can access your variables again with spaces instead of %20.

This does affect other special characteres as well. There is a
server-function that you can use to encrypt a string before processing
your document to the client: Server.HTMLencode (SomeString)
 
K

Kai Boenke

Ray at said:
Or Server.URLEncode(SomeString)

Kai Boenke said:
[snip other stuff]
This does affect other special characteres as well. There is a
server-function that you can use to encrypt a string before processing
your document to the client: Server.HTMLencode (SomeString)

You are right.
"Server.HTMLencode (SomeString)" actually does something different (not
completely but useless in this case): Converting characters to HTML
entities.
 

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
474,132
Messages
2,570,775
Members
47,332
Latest member
datacos561

Latest Threads

Top