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 26393
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: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
| |