I am creating a querystring to look like this:
form_edit.aspx?collectionID=25&confirmationMes sage=New+form+entry+saved
Note that I'm escaping the ampersand.
However, I can't grab the 'confirmationMessage' querystring unless I do NOT
encode the ampersand. I assume I'm missing something obvious here. Any
suggestions?
-Darrel 13 26400
Are you looking for Server.URLEncode? http://www.4guysfromrolla.com/webtech/042601-1.shtml
Or maybe Server.HTMLEncode and Server.HTMLDecode? http://www.devx.com/tips/Tip/13459
--
I hope this helps,
Steve C. Orr, MCSD, MVP http://SteveOrr.net
"darrel" <no*****@hotmail.com> wrote in message
news:Ol**************@TK2MSFTNGP10.phx.gbl... I am creating a querystring to look like this:
form_edit.aspx?collectionID=25&confirmationMes sage=New+form+entry+saved
Note that I'm escaping the ampersand.
However, I can't grab the 'confirmationMessage' querystring unless I do NOT encode the ampersand. I assume I'm missing something obvious here. Any suggestions?
-Darrel
I'm curious why do you need to encode the ampersand? Is it to comply to XHTML
standards?
Cheers,
Tom Pester I am creating a querystring to look like this:
form_edit.aspx?collectionID=25&confirmationMes sage=New+form+entry+ saved
Note that I'm escaping the ampersand.
However, I can't grab the 'confirmationMessage' querystring unless I do NOT encode the ampersand. I assume I'm missing something obvious here. Any suggestions?
-Darrel
I suggest that you put one more ampersand after & because each and every
value in a query string is separated by ampersand. For example
index.aspx?a=5&b=10. In your example,
form_edit.aspx?collectionID=25&&confirmationMe ssage=New+....
I hope it helps to encode/decode.
"darrel" wrote: I am creating a querystring to look like this:
form_edit.aspx?collectionID=25&confirmationMessage =New+form+entry+saved
Note that I'm escaping the ampersand.
However, I can't grab the 'confirmationMessage' querystring unless I do NOT encode the ampersand. I assume I'm missing something obvious here. Any suggestions?
-Darrel
Kevin Spencer wrote: The ampersand is a standard URL delimiter for parameters in a query string. It should never be HTML-Encoded.
Unless it's being included within the HTML itself (for example, in an anchor
tag), in which case it should.
This is valid XHTML (and works just fine):
<a href="http://myserver/mypage.aspx?a=1&b=2">Link</a>
When clicked, the actual URL that will be present in the browser will have a
plain ampersand between the two parameters, not an encoded ampersand.
This is not valid (though it also works):
<a href="http://myserver/mypage.aspx?a=1&b=2">Link</a>
HTML can be a pain in the backside sometimes.
--
(O)enone
> I'm curious why do you need to encode the ampersand? Is it to comply to
XHTML standards?
I don't *need* too...just trying to get in the habit of doing it.
-Darrel
> I suggest that you put one more ampersand after & because each and every value in a query string is separated by ampersand. For example index.aspx?a=5&b=10. In your example, form_edit.aspx?collectionID=25&&confirmationMe ssage=New+....
I hope it helps to encode/decode.
The problem is that I still have an unencoded ampersand in the URL then.
-Darrel
> The ampersand is a standard URL delimiter for parameters in a query
string. It should never be HTML-Encoded. If you want to send a literal ampersand, you should use URL-Encoding, as per my first suggestion.
I was under the impression that an amersand in a URL, unenecoded, was
invalid XHTML. http://www.456bereastreet.com/archiv...nd_validation/
Also, you introduce the problem of accidently creating an unintentional
entity:
mypage.aspx?id=2&litude=4
----
which can mess up some browsers.
-Darrel This is valid XHTML (and works just fine):
<a href="http://myserver/mypage.aspx?a=1&b=2">Link</a>
When clicked, the actual URL that will be present in the browser will have
a plain ampersand between the two parameters, not an encoded ampersand.
Ah! Perhaps that's my problem. I'm not creating an href link, but rather,
I'm using response.redirect
-Darrel
A URL is not HTML or XHTML. It is a URL. I was speaking in the context of a
URL, not the HTML document itself. When a URL is inside an HTML document (in
a link, for example), it needs to be HTML-Encoded. Otherwise not. See http://www.gbiv.com/protocols/uri/rfc/rfc3986.html
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
"darrel" <no*****@hotmail.com> wrote in message
news:u9**************@TK2MSFTNGP09.phx.gbl... The ampersand is a standard URL delimiter for parameters in a query string. It should never be HTML-Encoded. If you want to send a literal ampersand, you should use URL-Encoding, as per my first suggestion.
I was under the impression that an amersand in a URL, unenecoded, was invalid XHTML.
http://www.456bereastreet.com/archiv...nd_validation/
Also, you introduce the problem of accidently creating an unintentional entity:
mypage.aspx?id=2&litude=4 ----
which can mess up some browsers.
-Darrel
> a link, for example), it needs to be HTML-Encoded. Otherwise not. See http://www.gbiv.com/protocols/uri/rfc/rfc3986.html
OH! I think this clarifies things. So, if it's a URL in my codebehind (as a
response.redirect) encoding is rather pointless?
-Darrel
darrel wrote: Ah! Perhaps that's my problem. I'm not creating an href link, but rather, I'm using response.redirect
Right, in that case, you don't want to encode ampersands when you're using
them as value separators.
You'd only encode them in a Response.Redirect if they actually formed part
of one of the values, as detailed somewhere else on this thread.
--
(O) e n o n e This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: micha |
last post by:
my php script gets delivered text that contains special chars (like
german umlauts), and these chars may, may partially or may not be
coverted into html entities already. i don't know beforhand.
...
|
by: Travis Pupkin |
last post by:
How do you handle an ampersand (&) if it appears as part of the string
in a querystring? Is there a way to tell the server it is not the
beginning of a new variable being passed, but rather just a...
|
by: SDM |
last post by:
I need to create a stylesheet to allow the querystring in my attribute links
to format as:
<TD<A href='IQNet.asp?f=2&t=3'>Choice 1</A></TD>
not
<TD<A href='IQNet.asp?f=2&t=3'>Choice...
|
by: AJ Brown |
last post by:
How does one allow the use of ampersands (or other special characters
for that matter) within Element text and Attribute text?
I have problems using LoadXml from a string "<text value="Jack &...
|
by: Larry |
last post by:
I am hoping there is a way to encode the querystring part of a URL reached
from a hyperlink that will cause the Request to not drop the info after the #
in the URL string. Any clues or links to...
|
by: Dariusz Tomon |
last post by:
Hi
My problem is like that:
I'm trying to pass values branza and jezyk in querysting:
http://localhost/euroadres/pokazbranza.aspx?branza=transport
lotniczy&jezyk=1
Branza is type...
|
by: |
last post by:
Hi all,
If I am reading this right, then the querystring parameters must be "&"
and not "&". However, IIS 6.0 and asp.net request.querystring fails to
capture the values if "&" is specified....
|
by: Elroyskimms |
last post by:
I have to encode an address which contains an ampersand (&) into a URL
with various querystring parameters. The following code works fine:
URLString = "www.myserver.com?AD1=" &...
|
by: subbusuresh |
last post by:
hi,
Any one can help me.
<asp:GridView ID="grvDCList" runat="server" AutoGenerateColumns="False" >
<Columns>
<asp:HyperLinkField HeaderText="DC Number" DataNavigateUrlFields="Code"
...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
| |