复制代码 代码如下:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
string oldUrl = HttpContext.Current.Request.RawUrl ;
string pattern = @"^(.+)default/(/d+)/.aspx(/?.*)*$";
string replace = "$1default.aspx?id=$2";
if(Regex.IsMatch(oldUrl, pattern, RegexOptions.IgnoreCase | RegexOptions.Compiled))
{
string newUrl = Regex.Replace(oldUrl, pattern, replace, RegexOptions.Compiled |
RegexOptions.IgnoreCase);
this.Context.RewritePath(newUrl);
}
}
新闻热点
疑难解答
图片精选