This post originated from an RSS feed registered with .NET Buzz
by Peter van Ooijen.
Original Post: Getting my head around HTTPheader and HTMLheader. But no favicon yet.
Feed Title: Peter's Gekko
Feed URL: /error.htm?aspxerrorpath=/blogs/peter.van.ooijen/rss.aspx
Feed Description: My weblog cotains tips tricks and opinions on ASP.NET, tablet PC's and tech in general.
Thanks to the great feedback on my last post on Response.AppendHeader I'm beginning to see some light. I was indeed naive Response.AppendHeader appends a HTTP header to the response. A HTTP header indicates things like downloadable files. I was trying to manipulate an HTML header which steer the layout of the HTML rendered by the browser.
The HTML returned to the browser can be manipulated in every detail by using the Response.Filter property. Page Brooks pointed to a nice article on completely customizing the HTML header. Which has its price and does not solve everything.
The pages in my application need two links:
A link to a stylesheet. This link does not have to be in the head of the page to work. As Codebetter buddy Benpointed out you can also put this in an user control. My app has a menubar used on all pages, the stylesheet is now dynamically set in the text of a literal control there. Which resembles my very first try at the problem (where I created literals on the fly in the init of the basepage) but without any dirty hacks. That's solved and clear.
A link to an icon. But even when this link is hard coded in the header of an aspx the icon does not show up. According to the HTML editor of VS (2003 and 2005) the "Shortcut Icon" value for the REL attribute is unknown. The icon shows on the default.aspx main page because it is in the root and has the default FavIcon.ico name. But as it looks now asp.net is blank on it.
As the last post had such great feedback I'm not giving up yet. Does anybody know the way to set an icon from code ?