views:

368

answers:

3

Hi, I have a asp.net mvc web application an it uses some favicon.ico. Now when I move it to IIS 7, as an application, the favicon stops being presented even when I try to enter the full address to the favicon. The icon is still there; the full address works in the browser to find the icon alone, but not within the applications master page. The code is standard and same as on some others of my apps, but there it works.

<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
    <link rel="shortcut icon" href="../../Content/Images/favicon.ico" />
    <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Scripts/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="../../Scripts/Site.js"></script>
</head>

Any ideas why this might be?

+3  A: 

If I remember correctly, in Internet Explorer, the favicon needs an absolute URL. If that doesn't help:

  • Maybe IIS serves the icon file with the wrong content type? I think the correct one is image/vnd.microsoft.icon. See this page for a way to set up the content type in IIS
  • There are a number of additional hints on this page
Pekka
A: 

try changing your link tag to:

<link rel="shortcut icon" href="/Content/Images/favicon.ico" type="image/x-icon" />
tster
+1  A: 

Browsers are very finicky about favicons. They will not always retrieve them on a refresh and oftentimes they will skip them at will.

The best approach is to place your favicon in your document root so that tthe link is /favicon.ico. Also make sure it is a real Microsoft format .ICO icon file. Looking it up through a path with parent directories .. - like you do here - is asking for problems.

There is no formal cross server and browser standard, for more information see: http://en.wikipedia.org/wiki/Favicon

Matijs
The .. notation is here because of asp.net mvc. It has in some great properties, but when it comes to displaying images, it's hell.
Trimack