asp.netiis-7httphandler

Application_BeginRequest called for images


I've seen a few posts about Application_BeginRequest, but non seems to have my problem.

My Application_BeginRequest is being called for every image in my website.

The StaticFileHandler is enabled with * as the Path, but it's at the end of the list.

Is this the normal behaviour? Or should I add .gif, .jpg and so on on top of the list?

This is on my IIS7.5 Win7 Development Server. Didn't check it on the production server yet.

Update: Setting runAllManagedModulesForAllRequests="false" would help. But then the ASP.NET URL Mapping does not work anymore. I tried disable it just for the image directly, but that had no effect?

<location path="Resources">
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="false">
    </modules>
  </system.webServer>
<location>

Solution

  • make sure this value is false in your web.config.

    <modules runAllManagedModulesForAllRequests="false">
    

    if you are running an MVC app I'd suggest looking at this post