我想将某个URL的?a=5&b=8
部分变成字典{a:5,b:8}。ASP.NET MVC解析URL查询部分
在.net中是否有这样的方法或我自己?
我需要解析查询部分,以便我可以实现自己的URL解码。 问题是Firefox根据使用的字母表使用不同的编码(UTF8或ISO-8859-1)。
实施例:
火狐编码如下:
- v v
http://localhost:8041/Reforge.aspx?name=ArcânisГ
Firefox turns into
http://localhost:8041/Reforge.aspx?name=Arc%C3%A2nis%D0%93`
注意UTF8
编码用于两个非ASCII字符。
- v
http://localhost:8041/Reforge.aspx?name=Arcâ
Firefox turns into
http://localhost:8041/Reforge.aspx?name=Arc%E2
请注意,ISO-8859-1
(Latin-1)编码用于非ASCII字符。
这里有一个相关的问题:ASP.NET MVC does not understand mixed url encoding (UTF-8/Latin-1)
Request.QueryString中的问题是,它也取消转义值,则进行反向转义,我需要处理。详细信息:firefox可以使用utf-8或latin-1来转义字符,但ASP.Net MVC一直使用其中一种。 – 2010-11-15 17:55:30
你能写一个例子吗? – 2010-11-15 20:30:20
请参阅问题中的示例 – 2010-11-15 23:11:03