且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在查询字符串中正确编码&符号

更新时间:2023-11-07 23:07:58

您在寻找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&amp;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 &LT;无***** @ hotmail.com&GT;在消息中写道

新闻: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