convert dynmic page to static

来源:互联网 发布:superjunior厂牌知乎 编辑:程序博客网 时间:2024/06/06 08:34
在 Global.asax 中添加 Application_BeginRequest 事件:
protected void Application_BeginRequest(object sender, EventArgs e)
{
string pathAndQuery = Request.Url.PathAndQuery.ToLower();
if (pathAndQuery.IndexOf(".html") > -1)
{
pathAndQuery = "~/" + pathAndQuery.Replace(".html", ".aspx");
HttpContext.Current.RewritePath(pathAndQuery);
}
}