Favicon Icon-MVC3 ASP.NET

2020-07-10 20:15发布

问题:

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

回答1:

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(/.*)?" });


回答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.



回答3:

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.



回答4:

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.