2

I've seen many questions on SO and blogs how to configure MVC to not route request calls to favicon.ico file but no one seems to work for me. The lates blog I read was the Phil Haack http://haacked.com/archive/2008/07/14/make-routing-ignore-requests-for-a-file-extension.aspx but I still see the calls to the favicon.ico file resulting in 404 error status code.

I know that there is many workarounds but would like to know why it just doesn't work with that delcaration :

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

which is at the begining of the route registrations.

I'm working with MVC 3, Chrome and IISExpress

What I'm missing ?

Tomasz Jaskuλa
  • 15,723
  • 5
  • 46
  • 73

1 Answers1

7

the IgnoreRoute for the favicon makes it so that .net doesn't do anything when the favicon is requested. You still need to have a favicon.ico file in your application in order to prevent requests from returning 404.

Google Chrome (among other browsers) automatically requests the favicon every time you browse to your site so that it can display it in the tabs.

Community
  • 1
  • 1
Chase Florell
  • 46,378
  • 57
  • 186
  • 376
  • 2
    I'm getting this 404 when trying to call a Web API REST method from a handheld (Compact Framework/Windows CE app). Why would a REST method think it needs to look for/present favicon? – B. Clay Shannon-B. Crow Raven Sep 04 '14 at 18:13