6

What is the need of favicon.ico. I am trying to use MVC error handling and it complaines file being missed.How do get rid off this error.

Thanks

Hari Gillala
  • 11,736
  • 18
  • 70
  • 117

4 Answers4

19

Go to the RegisterRoutes method of the Global.asax.cs file, and add this, as one of the first lines:

routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
MartinHN
  • 19,542
  • 19
  • 89
  • 131
2

I suggest you use it, instead of getting rid of it. Cause it's part of the web standards in UI design. Don't you like branding of your site? Then this is a crucial part of that branding.

Saeed Neamati
  • 35,341
  • 41
  • 136
  • 188
2

Solution:

<link rel="SHORTCUT ICON" href="http://www.youraddress.com/youricon.ico"/>" if you use localhost then href="http://localhost:port/youricon.ico" Note:Use other name instead favicon.ico.

Neno
  • 21
  • 1
1

Add the following to the beginning of your RegisterRoutes method:

routes.IgnoreRoute("favicon.ico");

Your browser will always ask the site for the favicon, this will ensure mvc doesn't try to resolve it.

Timbo
  • 4,505
  • 2
  • 26
  • 29