Reputation: 33880
When you have an image tag in your application like so:
<img src = @Url.Content("~/foo/bar.jpg") />
or like so:
<asp:image src = "~/foo/bar.jpg" />
or like so:
<input type = "image" ...>
and if this happens to be an ASP.NET application (Web Forms or MVC is irrelevant to the question, I assume, as the code serving images must be the same), which specific component serves requests for images?
Is it the Web server (IIS or Visual Studio's internal web server) or is it an ASP.NET HttpHandler that Microsoft wrote.
I remember there used to be a handler for serving resource files in ASP.NET 2.0. Is that the one that serves images, too? What's it called?
Why am I asking this question / What I am trying to do
I have an ASP.NET MVC application and I want to write my own custom HttpHandler or a Controller to serve static assets like images so that they get cached.
What I am planning to do it something almost exactly similar to http://blog.hompus.nl/2011/03/11/make-your-browser-cache-the-output-of-an-httphandler/ and http://archive.msdn.microsoft.com/ResourceCache
I want to make sure that if there's one already written by Microsoft, I might need to take some precautions while sending back Http headers in the response just so that the headers Microsoft's in-built httpHandler sets are not in contradition to the ones I set.
Upvotes: 7
Views: 207
Reputation: 33880
Okay, it appears to me that ASP.NET doesn't care much for any static resources and therefore, it doesn't register an ISAPI filter with IIS for any of those resources.
That means, as a developer who wants to write a specific handler for static resources, you're pretty much free to do whatever you want.
Upvotes: 1
Reputation: 11433
By default, all requests for ASPX pages (including static resources therein, like images) are served by the default HttpHandler
, which is an instance of the PageHandlerFactory
class:
Instances are created dynamically to handle requests for ASP.NET files. The PageHandlerFactory class is the default handler factory implementation for ASP.NET pages.
As you can see from the MSDN article on HttpHandlers and HttpModules, the primary "built in" handlers are those for
There is not one that is specifically handling image requests. So you should be good to go =)
Upvotes: 2