日期:2014-05-17  浏览次数:20405 次

Request请求字段title翻页会自动改变?怎么办?
在网页首页设置了全站查询功能,代码如下:
 protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
           string title = this.title.Text.Trim();
           Response.Redirect("list.aspx?id=" + id + "&title=" + title + "");
     }
 
查询后进入list.aspx页面,地址栏显示
http://www.sgzjkj.com/list.aspx?id=1&title=%e9%93%81%e4%b8%80%e5%b0%8f
但当点击翻页后,地址栏的title值自动改变如下:
http://www.sgzjkj.com/list.aspx?id=1&title=%u94c1%u4e00%u5c0f
请问怎么回事?谢谢!!

------解决方案--------------------
title等于“铁一小”。

你调试下。两个title编码不同,但是表示的值一样。
------解决方案--------------------
具体情况我也不是很清楚,但估计问题是出在分页的控件上,给你一段我自己写的分页控件的后台代码,也不知道是不是对你就真的有用
        string strPath = GetPath();
        for (int i = 1; i <= 5; i++)
        {
            HyperLink hl = (HyperLink)FindControl("hl" + i.ToString());
            if (btn != null)
              hl.NavigateUrl = strPath + "Page=" + (i + nOffset).ToString();
        }
        
        
        private string GetPath()
        {
            string strPath = "";

            NameValueCollection coll = Request.QueryString;
            for (int i = 0; i < coll.Count; i++)
            {
                string strKey = coll.GetKey(i);
                if (strKey != "Page")
                {
                    string[] strValues = coll.GetValues(i);
                    if (strValues.Length > 0)
                        strPath = strPath + st