Sunday, October 21, 2012

How to add favicon in your asp-net site?

Make your site impressive and standard by displaying favicon. This is a practice of branding also. See in the following image the red circled area at the top corner. The black filled square is the favicon of dotnetspidor: A dot net programming blog. You can see the favicons in almost all of the popular websites.
So how to achieve this? First create a favicon image of your own. Visualize a great logo/image for the favicon. Save it as favicon.ico. Drop it at the root folder of your site. Now you are one step away - just put the following two links just below the title of header of your form. If you are using master page, just put these lines in the master page and you are done for all the pages.
  1. <title></title>  
  2. <link id="Link1" runat="server" rel="shortcut icon" href="favicon.ico" type="image/x-icon">  
  3. <link id="Link2" runat="server" rel="icon" href="favicon.ico" type="image/ico">      
So why the two lines? Normally the first link works. But for some tricky and picky browsers the second link will work. All the best!