不过我想了一个解决办法:
1.创建一个HttpModule 类在此类中进行Url重写:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text.RegularExpressions;
namespace NewRay.Web.HttpModule
{
public class DecodeModule:IHttpModule
{
#region IHttpModule 成员
public void Dispose()
{
throw new NotImplementedException();
}
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(context_BeginRequest);
}
void context_BeginRequest(object sender, EventArgs e)
{
HttpApplication application = (HttpApplication)sender;
HttpContext context = application.Context;
string str = context.Request.RawUrl;
int eqindex = str.LastIndexOf('=');
int sv = str.IndexOf("searchvalue");
if (eqindex > 0 && sv > 0)
{
string nowstr = str.Substring(eqindex + 1);
if (!"".Equals(nowstr) && nowstr != null)
{
Regex reg = new Regex("^[\u4e00-\u9fa5]{0,}$");
if (reg.IsMatch(nowstr))
{
string schineser = HttpUtility.UrlEncode(nowstr);
context.RewritePath("/searchlist.aspx?typevalue=product&pctype=tese&searchvalue=" + schineser + "");
}
}
}
}
#endregion
}
}
2.在后台进行解码:
string str= HttpUtility.UrlDecode(strvalue);
注:在ie内核的好用。