protected void Application_BeginRequest(object sender, EventArgs e)
{
string ss = HttpContext.Current.Request.Url.AbsolutePath;
string url1 = "/index.html";
if (HttpContext.Current.Request.Url.AbsolutePath == url1)
{
HttpContext.Current.RewritePath("login.aspx");
}
//2
string url2 = "/qxsz/index.html";
if (HttpContext.Current.Request.Url.AbsolutePath == url2)
{
HttpContext.Current.RewritePath("index.aspx");
}
}
上面的代码是在global.ashx中
本文介绍了一段ASP.NET全局事件处理代码,用于在应用启动时根据请求URL进行URL重写,实现了对特定URL路径的重定向。

被折叠的 条评论
为什么被折叠?



