如何在查询字符串中正确编码&符号 [英] how to properly encode ampersands in querystring
问题描述
我正在创建一个如下所示的查询字符串:
form_edit.aspx?collectionID = 25& amp; confirmationMes sage = New + form + entry + saved
注意我正在逃避&符号。
但是,我不能抓住''confirmationMessage''查询字符串,除非我不这样做/>
编码&符号。我想我在这里遗漏了一些明显的东西。任何
建议?
-Darrel
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
推荐答案
您在寻找Server.URLEncode?
http://www.4guysfromrolla。 com / webtech / 042601-1.shtml
或者可能是Server.HTMLEncode和Server.HTMLDecode?
http://www.devx.com/tips/Tip/13459
-
我希望这会有所帮助,
Steve C. Orr,MCSD,MVP
http://SteveOrr.net
" darrel" <无***** @ hotmail.com>在消息中写道
新闻:Ol ************** @ TK2MSFTNGP10.phx.gbl ...
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...
我正在创建一个查询字符串看起来像这样:
form_edit.aspx?collectionID = 25& amp; confirmMes sage = New + form + entry + saved
请注意,我正在逃避&符号。
然而,除非我对&符号进行编码,否则我无法获取''confirmationMessage''查询字符串。我想我在这里遗漏了一些明显的东西。任何建议?
-Darrel
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
>你在寻找Server.URLEncode吗?
> Are you looking for Server.URLEncode?
http://www.4guysfromrolla.com/webtech/042601-1.shtml
或者Server.HTMLEncode和Server.HTMLDecode?
http://www.devx.com/tips/Tip/13459
嗯,我正在手动编码''但是,也许我需要取消编码。
那么,怎么会我在HTMLDecode之后在URL中调用了一个查询字符串?
或者我会解码它,然后将其解析为文本字符串吗?
- Darrel
Well, I''m ''encoding'' it manually, but yea, maybe I need to unencode it.
So, how would I call a querystring in a URL after HTMLDecode?
Or would I decode it, then just parse it as a text string?
-Darrel
你可以这样做。或者,在接收页面上,您可以使用
代码来获取值。
Dim nvc As NameValueCollection
nvc = Request.QueryString
这里有更多信息:
http://msdn.microsoft.com/library/de ... .ClassTopic .asp
---
我希望这会有所帮助,
Steve C. Orr,MCSD,MVP
http://Steve.Orr.net
>
darrel <无***** @ hotmail.com>在消息中写道
新闻:Oy ************** @ TK2MSFTNGP15.phx.gbl ...
You could do that. Or, on the receiving page you can get the value off the
querystring with
code something like this:
Dim nvc As NameValueCollection
nvc=Request.QueryString
Here''s more info:
http://msdn.microsoft.com/library/de...ClassTopic.asp
---
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"darrel" <no*****@hotmail.com> wrote in message
news:Oy**************@TK2MSFTNGP15.phx.gbl...
您在寻找Server.URLEncode吗?
http ://www.4guysfromrolla.com/webtech/042601-1.shtml
或者Server.HTMLEncode和Server.HTMLDecode?
http://www.devx.com/tips/Tip/13459
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
>
好吧,我正在手动编码'但是,也许我需要取消编码。
那么,在HTMLDecode之后如何在URL中调用查询字符串? ?
或者我会解码它,然后将其解析为文本字符串?
-Darrel
Well, I''m ''encoding'' it manually, but yea, maybe I need to unencode it.
So, how would I call a querystring in a URL after HTMLDecode?
Or would I decode it, then just parse it as a text string?
-Darrel
这篇关于如何在查询字符串中正确编码&符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!