在重写时强制使用小写 URL 的最佳方法是什么?
- Global.asax?
- web.config?
一切都失败了……我做错了什么?请参阅以下内容:
Global.asax
不知道用什么方法?
void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext context = HttpContext.Current;
string path = Request.Path.ToLower();
context.RewritePath(path);
}
web.config
我试过使用 web.config 方法但无法管理:
<rewrite url="(.*)$" to="$1" permanent="true" />
如何更改上面的代码,使其自动将 url 强制为小写?
请您参考如下方法:
