art-ificial ramblings...

Wednesday, September 17, 2008

Sharepoint Favicon.ico

Very seldomly do I post something technical. However, today, I just spent 4 hours on something as simple as a favicon. For those who don't know what a favicon is, just look at URL (web address). Sometimes, there will be a little icon associated with the URL. This is a simple process, basically you save a file as "favicon.ico" and stick it in the root directory of your web folder. (Save as is not synonymous to renaming the file.)

The tricky part is if you have Masterpages. What's even trickier is if you are using Sharepoint.

So I first attempted to place the favicon.ico under the root of each Sharepoint site. Did not work. (Checked permissions..etc)

Then I edited the default.master page to add the links to the .ico file. Still did not work. While googling the problem, I came across some thing about checking in a file in the Site Settings area. This was a big mistake as it caused the dreaded error: "The enablesessionstate attribute on the page directive is not allowed in this page" in the default.aspx page. The only way to fix this was to reset the site definition. This is dangerous because any customizations would be lost. Fortunately, this was just the development box. I was able to fix the page. I think this only works if you are using the Sharepoint designer which I wasn't.

What finally worked was editing the default.master page (do not check in). This must be the first line under the "head" tag

link rel="icon" href="/_Layouts/PWA/Images/favicon.ico" type="image/png"
link rel="shortcut icon" href="/_Layouts/PWA/Images/favicon.ico" type="image/png"

and then placing the favicon in the appropriate folder listed. In my case: _Layouts/PWA/Images/

I originally stuck the image in the "TEMPLATE\IMAGES" and it should have been the "TEMPLATE\LAYOUTS\PWA\IMAGES". And the links must be the first line under the "head" tag in the default.master page. Clear out the cache and voila!

2 Comments:

  • I'll bet you're smart enough to back up your work too. The sharepoint server crashed at my school over the summer and we've had to do without it because they don't have time to rebuild the site right now. They just this week found a backup on a hard drive so they don't have to start from scratch.

    You gotta love the system!

    at 6:07 PM  

  • I'm not very fluent in what ever language that was. I get the idea that I should not screw around with code.

    at 2:01 PM  

Post a Comment

<< Home