佛山软件定制

HtmlEncode,HtmlDecode,UrlEncode,UrlDecode的使用

HtmlEncode和HtmlDecode用于Html的编码和解码

UrlEncode和UrlDecode用于Url的编码和解码,如用来编码Cookie里的中文字符号

HttpCookie cookie = new HttpCookie("account");
cookie.Domain = 'ops.cc';
cookie.Expires=DateTime.Now.AddSeconds(cookieSeconds);
cookie.Values.Add("username", account.UserName);
cookie.Values.Add("nickname",HttpUtility.UrlEncode(account.NickName));

 HttpCookie cookie = HttpContext.Current.Request.Cookies["account"];
 string NickName =HttpUtility.UrlDecode(cookie.Values["nickname"]);

posted on 2011-03-25 15:29  New.min  阅读(585)  评论(0编辑  收藏  举报

导航