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