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

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

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

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)方法

相关文章:

  • 2021-11-19
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-11-14
  • 2021-06-18
猜你喜欢
  • 2021-10-31
  • 2021-07-08
  • 2022-02-17
  • 2021-06-12
  • 2021-06-10
  • 2022-01-27
  • 2021-11-16
相关资源
相似解决方案