Asp.Net4.0/VS2010新变化(4):SEO的改进

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

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

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

现在可以直接这样写:

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 @ 2010-03-05 15:59  菩提树下的杨过  阅读(1046)  评论(0编辑  收藏  举报