1.确定引用 using System.Web;using System.Text;

传递页面:

<a target="_blank" href="news.aspx?sp=<%= Server.UrlEncode("网上公示")%>">



接收页面

<%

       string sp = HttpUtility.UrlDecode(Request["sp"], Encoding.GetEncoding("utf-8"));

  //.GetEncoding("gb2312")也可

   %>


2.发现html页面跳转到aspx页面 的中文参数也乱码,而且不能使用上面的方法

于是我果断传数字了 ,到aspx页面在转换成汉字


HttpCookie乱码:中文要先编码,调用的时候要转码

//赋值Cookie


HttpCookie cookiegroupname = new HttpCookie("groupname");

        cookiegroupname.Value = HttpUtility.UrlEncode("我是汉子");//编码

        HttpContext.Current.Response.Cookies.Add(cookiegroupname);

//调用

string name = HttpUtility.UrlDecode(Request.Cookies["groupname"].Value)//转码