Serving favicon.ico in ASP.NET MVC

I agree with the answer from Chris, but seeing this is a specific ASP.NET MVC question it would be better to use either Razor syntax:

<link rel="icon" href="https://stackoverflow.com/questions/487230/@Url.Content("~/content/favicon.ico")"/>

Or traditionally

<link rel="icon" href="https://stackoverflow.com/questions/487230/<%= Url.Content("~/content/favicon.ico") %>"/>

rather than

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

Leave a Comment