473,387 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

"&" 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 2299
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Arpan | last post by:
A link has the following URL: <a href="Page1.asp?cname=<%= Request.QueryString("cname") %>&cadd1=<%= Request.QueryString("cadd1") %>&cadd2=<%= Request.QueryString("cadd2") %>&cplace=<%=...
6
by: vigi98 | last post by:
Hello all, Can someone confirme that this: var strURLpiece = "UK & Ireland"; strURLpiece.replace("&", "%26"); replaces all occurrence of the character & by %26 in strURLpiece, ie that...
4
by: barney | last post by:
Hello, I' m using .NET System.Xml.XmlDOcument. When I do the following: XmlDocument xml = new XmlDocument(); xml.Load("blah"); .... xml.Save("blub"); I've got the problem that the following...
0
by: Martin Maurer | last post by:
Hello, i have a problem with NameValueCollection.Add or better with converting to a QueryString: NameValueCollection myQueryStringCollection = new NameValueCollection();...
5
by: martin | last post by:
Hi, I would be extremly grateful for some help on producing an xml fragemt. The fragment that I wish to produce should look like this <Addresses> <Address>&qout;Somebody's Name&quot;...
2
by: Mehdi | last post by:
Hi, I need to pass an URL via a hidden value as follow: <input type="hidden" id="Test" runat="Server"> and on Page_Load I assign a value to this hidden input as follow: Test.Value =...
2
by: beachboy | last post by:
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...
1
by: EoRaptor013 | last post by:
Not sure where to ask this question, but... I'm using a TreeView component to enable browsing file folders in a specific directory (for test purposes /Program Files/). Some users use an ampersand...
4
by: Winks | last post by:
How do I print the "&" symbol in an Access 2007 report? The help system says I should use the ASCI character 38 while holding the Alt key. This works---I can see it in the caption property, but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.