由 ASP(Big5) 傳含中文參數的值給 ASP.NET(UTF-8)
老是忘了,稍微紀錄一下
ASP (big5) 傳含中文的參數值到 ASP.NET (UTF-8)
傳送方 ASP (big5 編碼)
<a href="sample.aspx?arg=<%=Server.URLEncode("中文參數") %>">to ASP.NET</a>
接收端 ASP.NET (UTF-8)
//using System.Collections.Specialized;
string query = HttpUtility.UrlDecode(Request.Url.Query, System.Text.Encoding.GetEncoding("big5"));
NameValueCollection args = HttpUtility.ParseQueryString(query);
Response.Write(args["arg"].ToString());
參考資料:
http://blog.darkthread.net/post-2010-01-06-parsequerystring.aspx