2008年2月12日 星期二

UrlEncode解譯特殊字元碼

Server.UrlEncode( str)
HttpUtility.UrlEncode(str)

對 URL 字串進行編碼,以便實現從 Web 伺服器到用戶端的可靠的 HTTP 傳輸。

1、HttpUtility.UrlEncode,HttpUtility.UrlDecode是靜態方法,而Server.UrlEncode,Server.UrlDecode是

實例方法。

2、Server是HttpServerUtility類的實例,是System.Web.UI.Page的屬性。

3、用HttpUtility.UrlEncode編碼後的字串和用Server.UrlEncode進行編碼後的字串物件不一樣

Server.UrlEncode的編碼方式是按照本地程式設置的編碼方式進行編碼的,

而HttpUtility.UrlEncode是默認的按照.net的utf-8格式進行編碼的。

http://www.cnblogs.com/xiang/archive/2006/07/18/453918.html

===================
經過解碼的程序後
需要利用
decodeURI(字串)=>javascript的語法

Server.URLDecode(字串)
來編碼過
不然傳出值會是url碼



沒有留言: