views:

63

answers:

3

How can I prevent certain file types from going through the ASP.NET Pipeline (hitting global.asax, etc.)?

+1  A: 

global.asax is a HttpModule, and it will be called for every request that passes through the ASP.NET engine. Images, for example, do dot pass through ASP.NET engine. They are treated as static files.

I have breakpoints in the global.asax being hit when requesting images by themselves in IIS 7.5.
Brian David Berman
check in IIS handlers section to see if you have mapped images to ASP.NET engine. This is probably the case...
+1  A: 

What mode are you using? Integrated Pipeline or Classic? I think this will affect the answer.

But essentially, you just need to make sure your StaticFiles handler is not mapped to ASP.NET.

Bryan
+1  A: 

Note that if you are using the built-in visual studio web server (you say setting breakpoints), then you might experience subtle differences in behavior. Quoting from http://stackoverflow.com/questions/103785/what-are-the-disadvantages-of-using-cassini-instead-of-iis

Another dis-advantage is that it sends every request through the gloabal asax file which includes all requests for images and stylesheets. This means if you have code in there which does things with the file names, such as a look up, then the auxillary files willget processed too.

Mads Ravn