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,498
  • 18
  • 68
  • 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,112
  • 18
  • 85
  • 130
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
  • 34,403
  • 40
  • 131
  • 186
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,435
  • 2
  • 25
  • 27