468,720 Members | 1,567 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,720 developers. It's quick & easy.

"&" symbol in querystring

I have a problem if the parameter has a "&" symbol in querystring,

i think asp.net will split the value into 2 values as "&" is a spliter

any advise can give me to solve this problem?

P.S. I can't restrict user don't input "&" symbol when input

Thanks in advanced.
Feb 10 '06 #1
3 2034
Beachboy,

What kind of querystring are you talking about probably can I sumarize
hundreds.

Cor
Feb 10 '06 #2
if the user enters &, replace it with "%26" and try.
BCR

Feb 10 '06 #3
The HttpUtility class has a static UrlEncode function. It does safely
encodes a url that includes spaces and symbols so that they are correctly
interpreted by the server. This is safer, more maintainable and less error
prone than doing a manual concatenation.

From MSDN:
"If characters such as blanks and punctuation are passed in an HTTP stream,
they might be misinterpreted at the receiving end. URL encoding converts
characters that are not allowed in a URL into character-entity equivalents;
URL decoding reverses the encoding. For example, when embedded in a block of
text to be transmitted in a URL, the characters < and > are encoded as %3c
and %3d"

Incidentally, in ASP.Net, the UrlEncode is also available via the Server
object.

A related function you might be interested in the HttpEncode - it ensures
that any symbols are converted into valid html and prevents jscript hacks.
As a generate rule I always use HttpEncode when returning generated content.

I hope that helps,

Arnd Hurlbrink
"beachboy" <st*****@javacatz.com> wrote in message
news:eF**************@TK2MSFTNGP11.phx.gbl...
I have a problem if the parameter has a "&" symbol in querystring,

i think asp.net will split the value into 2 values as "&" is a spliter

any advise can give me to solve this problem?

P.S. I can't restrict user don't input "&" symbol when input

Thanks in advanced.

Feb 13 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Arpan | last post: by
6 posts views Thread by vigi98 | last post: by
4 posts views Thread by barney | last post: by
5 posts views Thread by martin | last post: by
2 posts views Thread by Mehdi | last post: by
2 posts views Thread by beachboy | last post: by
1 post views Thread by EoRaptor013 | last post: by
4 posts views Thread by Winks | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Oskars | last post: by
9 posts views Thread by bryonone | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.