c# asp.net page head,meta,title,css

 1 protected void Page_Load(object sender, EventArgs e)
 2         {
 3             //Page title 4.   
 4             Page.Title = "This is a title and meta test page.";
 5             //Encode/Content type 7.   
 6             HtmlMeta encode = new HtmlMeta();
 7             encode.HttpEquiv = "Content-Type";
 8             encode.Content = "text/html; charset=utf-8";
 9             Page.Header.Controls.Add(encode);
10             //Language 13.   
11             HtmlMeta lang = new HtmlMeta();
12             lang.HttpEquiv = "Content-Language";
13             lang.Content = "zh-cn";
14             Page.Header.Controls.Add(lang);
15             //Description 19.   
16             HtmlMeta desc = new HtmlMeta();
17             desc.Name = "Description";
18             desc.Content = "涂聚文,捷为工作室,经营信息流,物流,人力资源流,资本流的系统解决方案的开发与设计和服务,geoVI studio.Geovin Du. Systems Solution to Fund flow,and Information flow,and Material flow,and Control flow,and Human Resource.Applied software development,design and service";
19             Page.Header.Controls.Add(desc);
20             //Keyword 25.   
21             HtmlMeta keywords = new HtmlMeta();
22             keywords.Name = "keywords";
23             keywords.Content = "涂聚文,捷为工作室,经营信息流,物流,人力资源流,资本流的系统解决方案的开发与设计和服务";
24             Page.Header.Controls.Add(keywords);
25             //Robots
26             HtmlMeta Robots = new HtmlMeta();
27             Robots.Name = "Robots";
28             Robots.Content = "all index follow";
29             Page.Header.Controls.Add(Robots);
30             //Author
31             HtmlMeta Author = new HtmlMeta();
32             Author.Name = "Author";
33             Author.Content = "涂聚文";
34             Page.Header.Controls.Add(Author);
35               
36             //shortcut icon
37             HtmlLink shortcuticon = new HtmlLink();
38             shortcuticon.Href = "favicon.ico";
39             shortcuticon.Attributes.Add("rel""shortcut icon");
40             shortcuticon.Attributes.Add("type""image/x-icon");
41             Page.Header.Controls.Add(shortcuticon);
42             //icon
43             HtmlLink icon = new HtmlLink();
44             icon.Href = "favicon.ico";
45             icon.Attributes.Add("rel""icon");
46             icon.Attributes.Add("type""image/ico");
47             Page.Header.Controls.Add(icon);
48             //bookmark
49             HtmlLink bookmark = new HtmlLink();
50             bookmark.Href = "favicon.ico";
51             bookmark.Attributes.Add("rel""bookmark");
52             bookmark.Attributes.Add("type""image/ico");
53             Page.Header.Controls.Add(bookmark);
54 
55            //Link/CSS 31.
56             HtmlLink cssLink = new HtmlLink();
57             cssLink.Href = "MasterPage.css";
58             cssLink.Attributes.Add("rel""stylesheet");
59             cssLink.Attributes.Add("type""text/css");
60             Page.Header.Controls.Add(cssLink);
61 
62             //SqlDataSource sd = new SqlDataSource();
63             //sd.SelectCommand = "";
64             //sd.DataBind();
65             //访问来源
66             string refHost = HttpContext.Current.Request.UrlReferrer == null ? "" : HttpContext.Current.Request.UrlReferrer.Host.ToLower();
67             Response.Write("from: "+refHost);
68             if (!IsPostBack)
69                 FreezeGridviewHeader(GridView1, _tb, PanelContainer);
70         }
原文地址:https://www.cnblogs.com/geovindu/p/2001460.html