Global.asax 文件:
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// 在应用程序启动时运行的代码
}
void Application_End(object sender, EventArgs e)
{
// 在应用程序关闭时运行的代码
}
void Application_Error(object sender, EventArgs e)
{
// 在出现未处理的错误时运行的代码
}
void Session_Start(object sender, EventArgs e)
{
// 在新会话启动时运行的代码
}
void Session_End(object sender, EventArgs e)
{
// 在会话结束时运行的代码。
// 注意: 只有在 Web.config 文件中的 sessionstate 模式设置为
// InProc 时,才会引发 Session_End 事件。如果会话模式设置为 StateServer
// 或 SQLServer,则不会引发该事件。
}
void Application_BeginRequest(Object sender, EventArgs e)
{
context.RewritePath("/website2/rewritepath.aspx?id=2");//指向真实地址!
}
</script>
UR重写主要部分 Application_BeginRequest
这个方法里加判断语句实现 重写:比如一个正则表达式去判断
没有任何具体的页面,因为任何一个页面打开是都会执行上面那个代码所以 我只写了上面不分
这个还是在一个英文文章上看的 不知道大家看的明白不 希望大家都能明白