开发者

How to keep images (and other files) out of ASP.NET Pipeline

How c开发者_Python百科an I prevent certain file types from going through the ASP.NET Pipeline (hitting global.asax, etc.)?


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.


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.


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 What are the (dis)advantages 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.


If you are running Home version of Windows and can't install IIS because of that, consider using UltiDev Web Server Pro. It's free, lightweight, and unlike Cassini, it handles static content requests outside of the ASP.NET pipeline.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜