url重写步骤

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);
}

原文地址:https://www.cnblogs.com/zinan/p/3586089.html