lsyyx

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

asp.net4.0的webform中,对于Page对象新增加了二个属性:MetaKeywords,MetaDescription 

后端代码上,写法也更简单,以前可能需要这样写:

1
2
this.Header.Controls.AddAt(0, new HtmlMeta() { Name = "keywords", Content = Website.MetaKeyword });//关键字
this.Header.Controls.AddAt(1, new HtmlMeta() { Name = "Description", Content = Website.MetaDescription });//关键字描述      

现在可以直接这样写:

1
2
this.Page.MetaKeywords = "Asp.Net4.0";
this.Page.MetaDescription = "Asp.Net 4.0中新增了MetaKeywords与MetaDescription二个属性";

另外上一篇提到的"webform中也可以直接url路由"也算是一种对SEO的改进,

最后asp.net4.0中新增了Response.RedirectPermanent(string url)来取代Response.Redirect(string url)方法,用于将原来发送的"http 302"变成"http 301",这样据说对搜索引擎更友好(通俗的讲就是原来的Redirect重定向,并不会诱导搜索引擎顺着你的意思抓到新页面,而新的方法可以),类似的还有Response.RedirectToRoutePermanent(string routeName)方法

posted on 2014-10-23 08:56  lsyyx  阅读(165)  评论(0编辑  收藏  举报