Serving favicon.ico in ASP.NET MVC -


What is the last / best recommendation for favicon.ico in ASP.NET MVC?

I am currently doing the following:

  • Adding entry to very early of my register method:

      routes.IgnoreRoute ("favicon.ico");               

    I have two questions:

    • Is there no way to apply favicon.ico somewhere with the root of my application? It is exactly the same level as content and controllers .
    • Is it IgnoreRoute ("favicon.ico") enough of the statement - or should I also do the following as discussed in it I never know that favicon.ico Requested in any directory other than root - which will make it unnecessary (but it is good to know how to do this).

        route. Unknown route ("{* favicon}", new {favicon = @ "(. * /)? Favicon.ico (/.*)?"});  

Domains by keeping favicon.ico in your root Only IE5 really affects the IIRC. For more modern browsers, you should be able to include a link tag to point to another directory:

  & lt; Link rel = "shortcut icon" href = "http://www.mydomain.com /content/favicon.ico"/>  

You can also use non-echo files for browsers other than IE, for which I may be able to serve PNG in FF, etc. and IE:

  & lt; Link rel = "icon" type = "image / png" href = "http://www.mydomain.com/content/favicon.png" /> & Lt ;! - [if IE] & gt; & Lt; Link rel = "shortcut icon" href = "http://www.mydomain.com/content/favicon.ico" type = "image / vnd.microsoft.icon" /> & Lt; [Endif] - & gt;  

Comments