没有,自己增加一个呗在ASP.NET中实现和利用URL重写 Global.asax文件的Application_BeginRequest()方法
void Application_BeginRequest(object sender, EventArgs e) 

     string path = Request.Url.ToString(); 
     if (Regex.IsMatch(path, "/URLRewriting/OldUrl.aspx", RegexOptions.IgnoreCase)) 
     { 
            Context.RewritePath("/URLRewriting/NewUrl.aspx"); 
      } 
     else if (Regex.IsMatch(path, "/URLRewriting/UserAccount/(.+).aspx", RegexOptions.IgnoreCase)) 
    { 
         string idString = path.Substring(path.LastIndexOf('/') + 1, path.Length - path.LastIndexOf('/') - 6); 
        Context.RewritePath("/URLRewriting/UserAccount.aspx?id=" + idString);      } 
} 通过使用Request.Url属性来获得输入的URL路径,然后通过正则表达式来应用网站URL重写规则,匹配到期望的输入网址后,将它们重写成你希望转向的网址。 

解决方案 »

  1.   

    void Application_BeginRequest(object sender, EventArgs e)
        {
            if (HttpContext.Current.Request.UserHostAddress == "127.0.0.1")
            {
                HttpContext.Current.Response.Write("已被屏蔽");
                HttpContext.Current.Response.End();
            }    }
    我自己写了一个,但是调试的时候设置断点,这段代码根本不会跳进去运行
      

  2.   


    void Application_Start(object sender, EventArgs e)
            {
                // 在应用程序启动时运行的代码
                this.BeginRequest += new EventHandler(Global_BeginRequest);
            }
    void Global_BeginRequest(object sender, EventArgs e)
            {
                //throw new NotImplementedException();
            }
      

  3.   

    执行了。。我还在代码里写了一旦执行就创建一个TXT文件的。。每次都执行的
      

  4.   

    有些版本在Global.asax不会自动生成事件列表,手动输入可以的
      

  5.   

    这还不简单,随便写个过程然后绑定就可以了
        Sub myBeginRequest(ByVal sender As Object, ByVal e As EventArgs) Handles Me.BeginRequest
            Dim url As String = Request.Url.ToString
            
        End Sub