Link to home
Start Free TrialLog in
Avatar of lapucca
lapucca

asked on

Why my favicon isn't showing?

Hi, I'm using VS2013, asp.net web form and C#
I used the asp.net web form template.  The project rungs with the original, generic favicon that came with the project template.  I replace that file with my own favicon.ico file and still it shows that generic one.  I tried in different browsers and no change.  I also added these line to the site.master file and still no change.  Very odd, how to fix this?  Thank you.

    <link runat="server" rel="shortcut icon" href="~/favicon.ico" type="image/x-icon"/>
    <link runat="server" rel="icon" href="favicon.ico" type="image/ico"/>
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Try using href="http://mydomain.com/favicon.ico" or  better would be the absolute path href="/favicon.ico" if your favicon is top level.  If it is in another folder, just point to it via it's absolute path.   Also, make sure you can surf to your favicon so you know it is where you expect live.
Avatar of lapucca
lapucca

ASKER

Wow, that's crazy!  I navigate in my browser to "http://localhost:54569/favicon.ico"  and there it shows the generic favicon.ico that I already replaced with my own icon file.  Looking at the pc explorer and there is only my favicon file that I put there.  Where is my VS pulling this from?  mind buggling!
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lapucca

ASKER

Okay, I thought I lost my mind, no, I just lost my eye sight! lol...  I put the favicon in another project similar in name and just under it.

Now I can navigate to "http://localhost:54569/favicon.ico"   and the correct icon is displayed.  However, my program still shows the generic icon in the browser tab area.  I try absolute path and with ~/ path and both still displays the generic icon.  ??  Here is what I have in my master file's header section.  thank you

<head runat="server">
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title> <%: Page.Title %>/title>

    <asp:PlaceHolder runat="server">
        <%: Scripts.Render("~/bundles/modernizr") %>
    </asp:PlaceHolder>
    <webopt:bundlereference runat="server" path="~/Content/css" />
    <%--<link runat="server" rel="shortcut icon" href="~/favicon.ico" type="image/x-icon"/>--%>
    <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <link runat="server" rel="icon" href="/favicon.ico" type="image/ico"/>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>

</head>
View the source and make sure the link is good.  Clear your cache and try that too.
Avatar of lapucca

ASKER

I have never had such issue with having the favicon before.  This is so blizzard.  I looked at the page source and it lists the same link code as in my site.master file,
   <link runat="server" rel="icon" href="/favicon.ico" type="image/ico"/>
    <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />

I then deploy the code to our test web server and then open the site at the server IE browser after I remote into that server.  Well, it still not showing my favicon.  In a new browser tab, I type in the proper path to the favicon on the server and it does find and dispaly that icon file but in the application tab it now displays a blue "e" icon (IE icon).  

This is pretty crazy!  Thank you.
Avatar of lapucca

ASKER

I did a search on my drive for the file favicon.ico.  I then replace all the generic file with my icon file and the browser tab icon already changed to the correct one.  This is the tab left open with my application but I already click Stop debug in VS.   Still very odd how this happens but for now it's resolved.  Do you think it's pulling from a different file location ?  but in my code and in browser source it indicates the right place.   Thank you for all your help.