Last post Jun 25, 2009 09:47 PM by WilliamSnell
Aug 03, 2007 06:08 PM|diadem_2k|LINK
I am struggling with favicon.ico to be added to my web pages, i tried with a dummy asp.net page and trying to add that icon but it is failing everytime i do it??
can anyone help me out here: Just copy this code and replace .ico with the one you r having in your system and let me know if u see that icon:
-----thanks a lot in advance
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<link rel="shortcut icon" href="~/favicon.ico"/>
<form id="form1" runat="server">
<span style="color:Red; font-size:small">* </span><a href="http://www.google.com" target="_blank">Hello</a>
Aug 03, 2007 07:09 PM|BradFMJ|LINK
<link rel="shortcut icon" href="~/favicon.ico"/>
isnt being processed by .net. so href="~/favicon.ico" needs to be an absolute or relative url. ~ isnt treated as your app root.
Aug 03, 2007 07:17 PM|A1ien51|LINK
With IE6 and under in order for it to show up you have to have it bookmarked.
Aug 03, 2007 07:41 PM|JoshStodola|LINK
Just like this:
<link rel="shortcut icon" href="<%=ResolveUrl("~/favicon.ico")%>"/>
Hope this helps! Mark the helpful post(s) as Answer.
Aug 03, 2007 09:30 PM|diadem_2k|LINK
you were right...it worked thanks alot.
Nov 15, 2008 06:46 AM|dhanashivam|LINK
i used the above instructions for adding icon for my website. it works fine.
one more question.
should the icon file name be "favicon.ico"?
in my site, there is more than one form. should i need to set the <Link/> in all the pages or can i put it in some where else can call all the pages?
thanks in advance.
Nov 17, 2008 07:02 PM|NC01|LINK
I believe that it must be named favicon.ico to work. See
http://www.favicon.com/ie.html for more info.
Jan 15, 2009 11:04 AM|oguh|LINK
Sorry for bringing up an old thread but I am having difficulty what you have said above to add a favicon...
This is the code I have put into the head of my master page:
<head id="Head1" runat="server">
<link rel="shortcut icon" href="<%=ResolveUrl("~/images/favicon.ico")%>"/>
<asp:ContentPlaceHolder id="head" runat="server">
<link href="App_Themes/myapp/mystyle.css" rel="stylesheet"
I get the following error:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Jan 16, 2009 06:30 PM|NC01|LINK
Remove <%=ResolveUrl("~/images/favicon.ico")%> and place the actual URL to the image there.
Jan 27, 2009 08:40 AM|designsecrets|LINK
i have try your code but it didn't work
i added the previous code on my master page and i upload the the icon file on the root but nothing changed...
Jan 27, 2009 12:25 PM|A1ien51|LINK
OKAY, Will you PLEASE FOLLOW MY ADVICE, this is the last time I am going to say it.
Bookmark the page in Internet Explorer!
Jan 28, 2009 05:21 AM|designsecrets|LINK
thanks for reply Eric,
i tested it on IE7 and it works on the address bar and the tab bar NOT in the top title bar ??
in IE6 nothing appear EVEN i added the page to the favorite!!
if you like test it http://www.conformity.com.sa/
Jan 28, 2009 06:11 AM|birendra gaihre|LINK
Jan 28, 2009 01:49 PM|A1ien51|LINK
IE7 does a bad job at rendering it. I am guessing you are using a 32X32 image for that. It will probably be better if you optimize it for 16x16 instead.
Did you use an editor to convert it to an ico file or did you just change the extension? If you search for
convert to ico or convert to favicon you should get plenty of online tools that convert it.
Jan 28, 2009 08:27 PM|birendra gaihre|LINK
Yes, probably the best job is to scale it to 16x16. If someone needs good icons, here's the link
Feb 01, 2009 09:40 AM|designsecrets|LINK
i convert my icon from 32 to 16*16 using Icon maker software but it still not apear at all.
i added it to my master page head
the file favicon.ico is located on the root not in the images folder!!!
is there any way to activate it with IE6???
Feb 01, 2009 03:30 PM|NC01|LINK
Didn't A1ien51 already tell you that you need to bookmark it for it to work in IE6 (several times in fact)?
Feb 02, 2009 09:55 AM|designsecrets|LINK
I am sure i did add the page to IE6 favorite but no icons apear!! [*-)] is this what you mean by bookmark the site.
you can test it here www.conformity.com.sa
Jun 25, 2009 09:47 PM|WilliamSnell|LINK
My advice is to forget IE6. Unless that's a requirement, as in a business that won't upgrade their IE to a version that's not 8 years old, coding for that particular browser is nothing but headaches. If you upload a favicon and place the magic html code
in your <head> section, and it still doesn't appear anywhere, I ran into this issue and finally resolved it. You'll see a lot of posts to delete your Temporary Internet Files, as this is where the icon is being stored. That's true, but you also have to delete
your browsing history. I have no idea why, but once you've deleted those 2 things, wait about 30 seconds and open up your browser again. It should appear. If you're using the Favorites Links as a toolbar, you might notice that the old favicon is still there,
and the new one is up in your browser and on the tab. I'm not certain why this occurs, but just wait a bit (couple hours to a day or so), and it will fix itself.