Me Love You Runtime Code Monkey!

Favicon.ico 404 issue

So, sometimes you will find that browsers look for the favicon.ico file at the root of your site. A lot of the time you haven't yet/won't add one of these. As the browser looks for this, it can cause a 404 error in asp.net MVC. It can be made to ignore this file by adding the following code to the global.asax route index.

routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });

Thanks to Phil Haack for that nugget.

comments powered by Disqus