//asp.net中动态更改网站的标题、描述、关键字、和样式表 if (!IsPostBack) { //Page title网页标题 Page.Title = "我的网站标题"; //须将网页head标签设成服务器控件模式,即<head runat="server">,否则无效 //Description网页描述 HtmlMeta desc = new HtmlMeta(); desc.Name = "Description"; desc.Content = "我的网站描述"; Page.Header.Controls.Add(desc); //Keyword网页关键字 HtmlMeta keywords = new HtmlMeta(); keywords.Name = "keywords"; keywords.Content = "我的网站关键字"; Page.Header.Controls.Add(keywords); //Link/CSS HtmlLink cssLink = new HtmlLink(); cssLink.Href = "css/search.css"; cssLink.Attributes.Add("rel", "stylesheet"); cssLink.Attributes.Add("type", "text/css"); Page.Header.Controls.Add(cssLink); }
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)