tags:

views:

16

answers:

1

How to do it?

If I make a http module it only catches .aspx files. Files with other extensions (.js, .htm) are ignored.

Does this have anything to do with IIS?

Strangely enough all extensions are caught on the ASP.net Web Development Server but not when hosted in IIS.

A: 

Yes it does have something to do with IIS.

If you are using IIS7 there is a feature called "Integrated Pipeline" which will allow an IIS site to pass processing of all incoming files type to .net be they .aspx or not. This is especially useful for securing non-aspx resources. In order to still serve static file resources out of the box the .net runtime checks for the existence of a static file first, it there is none at the requested path it will go looking for a handler.

If you are using IIS6 (or earlier) or IIS7 in non-integrated pipeline mode (classic mode) you can still intercept requests for other extensions, and you'll have to configure IIS to send requests for these file types to .net. This is called "application extension mapping".

(P.S. I really tried to get some good links for this answer, but drew a bit of a blank. Try googling "Integrated Pipeline" and "application extension mapping").

Christopher Edwards
For IIS6 (or classic pipeline), you don't have to write handler. ASP.NET runtime already has handler for serving static files. All you need to do is to register extensions such as *.js, *.htm etc with ASP.NET ISAPI extension - you can do that from web site/folder properties.
VinayC
Yes correct, you only need to write handlers if you need the content server to be dynamic, if you are just looking to use .net for authentication etc. you don't need them. I'll edit...
Christopher Edwards