Archives

Archives / 2005 / August
  • Accessing the Html Header in ASP.NET 2.0

    I feel a bit silly for not figuring this out quicker, so hopefully I can redem myself by posting this to help people out.  Taking a look at the Page class there is a Header property that looks tempting to be able to do something like dynamically add a stylesheet.  The problem is that when you type in Page.Header it doesn't appear that you have full control over the header, even though there is the ever so tempting System.Web.UI.HtmlControls.HtmlHead class.  What I had been doing is throwing an id and a runat="server" onto the head tag in my HTML, which I really didn't like because an id tag on the head tag isn't valid XHTML 1.1.