Application_BeginRequest事件未触发

问题描述:

我正在处理Application_BeginRequest事件,该事件应该在请求某个url时触发。Application_BeginRequest事件未触发

protected void Application_BeginRequest(Object sender, EventArgs e) 
    {    
     if (HttpContext.Current.Request.Url.ToString() == DummyPageUrl) 
     { 
      RegisterCacheEntry(); 
     } 
    } 

这里是我以前的请求URL代码:

private void HitPage() 
    { 
     WebClient client = new WebClient(); 
     client.DownloadData(DummyPageUrl);    
    } 

不过的Application_BeginRequest事件不点火。 我也试过这个在web.config中:

<system.webServer> 
<modules runAllManagedModulesForAllRequests="true"> 
</modules> 

,没有工作。请帮帮我。

+0

您在使用经典或集成管线的IIS应用程序池? – RobSiklos

你在使用global.asax吗?

试试这个Global.asax中页面....

void Application_BeginRequest(object sender, EventArgs e) 
    { 



    }