我想將某個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