---
title: "How to Serving favicon.ico in ASP.NET MVC?"  
description: "How to Serving favicon.ico in ASP.NET MVC?"  
author: "Barbara Jones"  
published: 2015-01-22  
updated: 2015-01-22  
canonical: https://www.mindstick.com/forum/12893/how-to-serving-favicon-ico-in-asp-dot-net-mvc  
category: "asp.net"  
tags: ["c#", "asp.net mvc"]  
reading_time: 2 minutes  

---

# How to Serving favicon.ico in ASP.NET MVC?

What is the final/best recommendation for how to serve favicon.ico in [ASP.NET MVC](https://www.mindstick.com/forum/155798/what-is-caching-in-asp-dot-net-mvc)?

I am currently doing the following :

- Adding an entry to the **very beginning** of my [RegisterRoutes](https://www.mindstick.com/forum/12655/registerroutes-not-working-in-mvc5) method :

routes.IgnoreRoute("favicon.ico");

- Placing favicon.ico in the root of my [application](https://www.mindstick.com/articles/12824/calculator-application-in-android) (which is also going to be the root of my [domain](https://www.mindstick.com/articles/12298/how-to-select-seo-friendly-domain-names-for-your-new-website)).

I have two [questions](https://www.mindstick.com/blog/124895/hp-hpe0-s54-cheat-sheet-exam-questions-bank-for-guaranteed-success) :

- Is there no way to put favicon.ico somewhere other than the root of my application. Its pretty icky being right there at the same level as [Content](https://www.mindstick.com/articles/13019/get-the-best-content-marketing-pricing-packages-for-your-brand) and Controllers.
- Is this IgnoreRoute("favicon.ico") statement sufficient - or should I also do the following as discussed in a [blog post](https://answers.mindstick.com/qa/103651/what-is-a-blog-post) from Phil Haack I'm not aware of ever having seen a [request](https://www.mindstick.com/blog/255/post-get-and-request-function-in-php) to favicon.ico in any [directory](https://www.mindstick.com/forum/226/how-to-get-application-directory-using-c-sharp-csharp) other than the root - which would make this unnecessary (but its nice to know how to do it).

routes.IgnoreRoute("{*favicon}", new {favicon=@"(.*/)?favicon.ico(/.*)?"});

## Replies

### Reply by Tom Cruser

Placing favicon.ico in the root of your domain only really affects IE5, IIRC. For more modern browsers you should be able to include a link tag to point to another directory:

<link rel="SHORTCUT ICON" href="http://www.mydomain.com/content/favicon.ico"/>

You can also use non-ico files for browsers other than IE, for which I'd maybe use the following conditional statement to serve a PNG to FF,etc, and an ICO to IE:

<link rel="icon" type="image/png" href="http://www.mydomain.com/content/favicon.png" />

<!--[if IE]>

<link rel="shortcut icon" href="http://www.mydomain.com/content/favicon.ico" type="image/vnd.microsoft.icon" />

<![endif]-->


---

Original Source: https://www.mindstick.com/forum/12893/how-to-serving-favicon-ico-in-asp-dot-net-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
