Secret to Unique FavIcon.ico files in DotNetNuke
Well, it was a secret to me until yesterday anyhow.
If you are running a DotNetNuke installation with multiple portals, you may have noticed that even if you replace the FavIcon.ico file in the root of the application, you get the same FavIcon.ico file displaying for all of your portals. And, even if you have just one portal and upgrade the portal and forget to not copy the FavIcon.ico file up, of course you’ll have to recopy the one you want back up.
So, while I was trying to track down another problem yesterday, I was in the Default.aspx.vb file of the 4.8 release of DotNetNuke when I notice these lines:
Private Sub ManageFavicon() Dim strFavicon As String = _ CType(DataCache.GetCache("FAVICON" & _ PortalSettings.PortalId.ToString), String) If strFavicon = "" Then If File.Exists(PortalSettings.HomeDirectoryMapPath & _ "favicon.ico") Then strFavicon = PortalSettings.HomeDirectory & "favicon.ico" If Not Common.Globals.PerformanceSetting = _ Common.Globals.PerformanceSettings.NoCaching Then DataCache.SetCache("FAVICON" & _ PortalSettings.PortalId.ToString, strFavicon) End If End If End If If strFavicon <> "" Then Dim objLink As New HtmlLink() objLink.Attributes("rel") = "SHORTCUT ICON" objLink.Attributes("href") = strFavicon Page.Header.Controls.Add(objLink) End If End Sub
Check it out! It’s looking for a favicon.ico file in the portal’s directory (ie, portal/0, portal/1, etc) and if it finds it it is inserting
<link rel=”SHORTCUT ICON” href=”path to portal favicon.ico here” />
into the HEAD of the page.
This means that every portal can have a unique icon associated with it. Cool!
Other Related Items:
Facebook Favicon on HTZ Ozone custom coverAre you a Facebook fan? Show it off on this Coveroo!
Facebook Favicon on iPod Nano 8GB 5th GenAre you a Facebook fan? Show it off on this Coveroo! Prices are for a brand new iPod Nano 8GB (5th Gen) with artwork.
Facebook Favicon on Palm Centro custom coverAre you a Facebook fan? Show it off on this Coveroo!









