13

I know there is a solution to stop the mvc framework to process "favicon.ico" requests (solution), but i don't know why is it looking for this icon in the first place.

I searched using Find in Files > Entire Solution for favicon.ico and nothing was found.

I searched in the html source code of the website for favicon.ico and nothing was found.

Where is it? why the browser is trying to serve it?

Community
  • 1
  • 1
Catalin
  • 11,503
  • 19
  • 74
  • 147

4 Answers4

12

favicon.ico is a convention - but is one way that the browser can get the image for links, tabs, etc:

enter image description here

Note that these days, the image location can also be set in metadata (which is handy as it allows the image to be per-page rather than per-domain, and/or allows for serving it from a different location, such as a CDN):

<link rel="shortcut icon" href="//cdn.sstatic.net/stackoverflow/img/favicon.ico">
<link rel="apple-touch-icon image_src" href="//cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png">

However, "/favicon.ico" is the fallback, and is used by many old browsers - or where no explicit shortcut icon is specified.

Basically: go create one.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • Ok, i didn't knew about the convention. I thought that the browser will look for an icon file only if i set it in the html source code – Catalin Oct 29 '13 at 08:45
  • @RaraituL the info in the html is a very recent addition; historically, favicon.ico pre-dates that by over a decade – Marc Gravell Oct 29 '13 at 08:53
5

You better have one since it is standard to most browsers to look for the favicon.ico however if you really don't want to have it and get rid of the error just add this line in your RegisterRoutes class.

routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
Jobert Enamno
  • 4,403
  • 8
  • 41
  • 63
1

Some browsers just look for favicon.ico in the root of your website by default.
I think the easiest way to stop the browser looking for this file is provide the image once, then the browser will cache it and stop asking.

Buh Buh
  • 7,443
  • 1
  • 34
  • 61
0

The browser asks for it to set as the icon for the page, next to the title (in titlebar, tab, bookmarkmenu).

Peer
  • 36
  • 5