url重写:
在global文件中,在application_BeginRequest事件中
1:获取URL
string url=Request.AppRelativeCurrentExecutionFilePath;
2: 通过正则表达式匹配请求的URL,如果成功就重写路径。
Match match=Regex.Match(url, @"~/test_(\d+).aspx");
if (match.Success)
{
Context.RewritePath("/test.aspx?categoryId="+match.Groups[1].Value);
}

posted on 2014-03-07 11:44  芝麻的西瓜  阅读(257)  评论(0编辑  收藏  举报