private string baiduurl="http://www.abc.com?ee=";
           WebClient wClient = new WebClient();
           byte[] pageData = wClient.DownloadData(baiduurl +System.Net.WebUtility.HtmlEncode("这汉字要转成gb2312编码怎么转不过来啊");
           this.label3.Text = System.Net.WebUtility.HtmlEncode(this.textBox1.Text.ToString());
(中国=%D6%D0%B9%FA)http://www.abc.com?ee=%D6%D0%B9%FA
我想取到搜索后的网页

解决方案 »

  1.   

    Server.UrlEncode()进行url编码        private string baiduurl="http://www.abc.com?ee=";
            WebClient wClient = new WebClient();
            byte[] pageData = wClient.DownloadData(baiduurl + Server.UrlEncode("中国").ToString()); 
            this.label3.Text = System.Net.WebUtility.HtmlEncode(this.textBox1.Text.ToString());
      

  2.   

    编码
    System.Web.HttpUtility.UrlEncode("", Encoding.GetEncoding("gb2312")).ToUpper();
    UrlDecode
      

  3.   

    windows forms 窗体应用程序没办法用到如下写法Server.UrlEncode("中国").ToString()); 
      

  4.   


    在项目中添加引用:System.Web 使用方法:System.Web.HttpUtility.UrlDecode(“中国”);