c# asp.net page head,meta,title,css
2011-03-31 20:26
381 查看
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 }
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 }
相关文章推荐
- 如何在Asp.net的Header中添加/title/Meta tages/CSS
- ASP.NET中动态设置Head区域标记http://www.ronghu.net/spaces/u/badapple0412/asp-net-head-title-meta.shtml
- asp.net 动态添加title、meta tages、css
- .NET/ASP.NET/C#/WCF/SQL Server/My SQL/Java/JSP/JDBC/Spring/Spring MVC/PHP/Python/Ruby/Shell/Agile/CSS/HTML/HTTP/Unix/Linux大量PDF书籍/电子书籍下载, Effective Java 下载
- Asp.net 后台添加CSS、JS、Meta标签(帮助类)
- Asp.net 后台添加CSS、JS、Meta标签
- 清新空气---我的.net(C#)生涯知识总结 跨CSS,JS,JAVA,AJAX,WPF,WCF,LINQ,ASP.NET,Winform,Sqlserver,Mysql,EF,OOP,开发工具等
- asp.net操作Meta tages/Style/title/Header
- asp.net 动态设置标题title、meta(keywords、description)
- asp.net动态设置页面的title,meta标签
- Asp.net关于Header/title/Meta tages/Style操作的小技巧
- ASP.NET Master Page改变内容页title方法
- ASP.NET 修改Master Page中meta属性
- Asp.net 2.0中Header,title,Meta tages,Style操作
- asp.net操作Meta tages/Style/title/Header
- Asp.net 后台添加CSS、JS、Meta标签
- ASP.NET(C#)——不扩展System.Web.UI.Page
- Asp.net关于Header/title/Meta tages/Style操作的小技巧
- Asp.net 后台添加CSS、JS、Meta标签的写法
- Asp.net 2.0 关于Header/title/Meta tages/Style操作的一点小技巧