Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.

Sponsors

News

 
 
 
DZone MVB

Links

Social

ASP.NET MVC: Ignore requests to favicon.ico

One problem I faced when writing my example pet portal on ASP.NET MVC was Google Chrome’s request to favicon.ico that doesn’t exist. IE8 that I use (8.0.7000.0) doesn’t make these blind requests to discover that favicon.ico is not there. Solution to my problem was very simple. Just add the ignore rule for favicon.ico to Global.asax file, in the beginning of RegisterRoutes method:

 

NB! This blog is moved to gunnarpeipman.com

Click here to go to article

Comments

Trevor said:

I was adding some error logging code to my application last weekend when I kept getting the "File not found" error for favicon.ico. In the end i just created the damn thing to shut it up. But I prefer your solution, thanks!

# February 27, 2009 1:07 PM

Tiendq said:

Thank you for the solution, I'm going to add a global error handler for my current MVC project and favicon.ico request is very annoying.

# April 22, 2009 12:32 PM

chrispont said:

Perfect! This will really help, as I'm using an error handler to email me site errors and continually get emails regarding favicon.ico.

# May 28, 2009 5:56 AM

luke.sampson said:

Thanks Gunnar, very helpful!

# January 17, 2010 6:37 PM