Search code examples
asp.nethtmlfavicon

Favicon Not Showing


I have a favicon in my ASP.NET project that's not showing up. I have a masterpage located at ~/MasterPages/MasterPage.master that holds the favicon. My markup is as follows:

<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
<link rel="icon" href="/favicon.ico" type="image/x-icon"/>

The favicon is located in the project root. The dimensions are 16x16 and it's 32-bit depth. I've cleared my browser's cache, rebooted and nothing is working. Any suggestions as to what I should do?


Solution

  • Try placing a ~ and set the link elements to runat=server

    <link runat="server" rel="shortcut icon" href="~/favicon.ico" type="image/x-icon" />
    <link runat="server" rel="icon" href="~/favicon.ico" type="image/ico" />
    

    This also needs to be done in the <head> section of the page.