asp.net 2.0中可以访问head了

这个标题应该不那么贴切,但在ASP.NET 2.0中,可以很方便地动态改变页面的标题了,比如可以这样了

this.Header.Title = "This is the new page title.";

还可以动态改变css等了,如下两例

Style style = new Style();

style.ForeColor = System.Drawing.Color.Navy;

style.BackColor = System.Drawing.Color.LightGray;

this.Header.StyleSheet.CreateStyleRule(style, null, "body");

HtmlLink link = new HtmlLink();

link.Attributes.Add("type", "text/css");

link.Attributes.Add("rel", "stylesheet");

link.Attributes.Add("href", "~/newstyle.css");

this.Header.Controls.Add(link);