On our web server we want to provide urls that can be used in HTML elements, for displaying user profile pictures.
I could do this in two ways:
- put the images on the web server as static resources: mysite.com/user1.jpg
- implement an IHttpHandler: mysite.com/images?userid=1
are there any benefits of one method over the other?
Not handling images via ASP.NET but letting IIS deal with them as static content and circumventing the ASP.NET pipeline altogether would be fastest.
Implementing an
HttpHandler, apart from requiring code, would require the ASP.NET pipeline to be involved – this takes more resources from the server.Basically, if the content is static, let it be static and let IIS handle it.