By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,356 Members | 1,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,356 IT Pros & Developers. It's quick & easy.

"&" symbol in querystring

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
Beachboy,

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

Cor
Feb 10 '06 #2

P: n/a
if the user enters &, replace it with "%26" and try.
BCR

Feb 10 '06 #3

P: n/a
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.