How to Prevent Image Leeching with Custom RouteHandler

If you noticed that there is a high number of request for image files in your web server log files, it may be that someone is linking your images from their own site. This will affect not only your server but also your hosting plan as they are hogging bandwidth from your server. If you don’t want this to happen to your site, implement custom RouteHandler within ASP.NET MVC application.

Before you begin, review the flow of execution request that typically comes to your ASP.NET MVC site. When the IIS receives the request, it passes the request to ASP.NET based on the URL or to the file extension. If you use IIS7 in integrated mode, all requests are mapped to ASP.NET but if you use IIS 6, you can set up a wildcard mapping.

 

Read the rest of the tutorial here: http://www.mikesdotnetting.com/Article/126/ASP.NET-MVC-Prevent-Image-Leeching-with-a-Custom-RouteHandler

Leave a Reply

Your email address will not be published. Required fields are marked *