ASP.Net MVC : Ignore requests made to favicon.ico

By [)ia6l0 iii

If you browse your mvc pages, through modern day browsers like Chrome - you will find that there would be additional requests like the ones to the favicon. This is the icon, that appears to the left of the web address in the browser once the page loads.

In order to ignore this request, you would need to ignore the route. Add this in the RegisterRoutes method in the global.asax.cs file.
routes.IgnoreRoute("{*favicon}", new {favicon=@"(.*/)?favicon.ico(/.*)?"});

This would ignore all requests of favicon.ico.

Related FAQs

ASP.Net 4.0 provides the SetSessionStateBehavior method through the HTTPContext Class.
Use the Override versions of the page methods instead of thedefault page methods. This would ensure that the .Net runtime does not have to invoke delegates.
Use the "UrlReferrer" property of the Request object to retrieve the previous page url.
You can check the contenttype of the request, and figure out if the request is an JSon request
This error most widely occurs due to a corrupt temporary file. You can clean the solution, delete the temporary files and rebuild your solution.
Use the Proxy property of the Http Web Request to specify proxy.
ASP.Net MVC : Ignore requests made to favicon.ico  (2915 Views)