mvc: does the favicon.ico also look for a controller? mvc: does the favicon.ico also look for a controller? asp.net asp.net

mvc: does the favicon.ico also look for a controller?


Add this to you global.asax:

routes.IgnoreRoute("favicon.ico");


You can also specify the ignore route with constraints

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


The top answers are correct.

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

But for newer versions of MVC you must add this at the top of the RegisterRoutes method in RouteConfig.cs (so somewhere before routes.MapRoute(..) is called).