码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2014-10-23 09:19:05      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   color   io   ar   for   sp   

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

bubuko.com,布布扣

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

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

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

标签:des   style   blog   http   color   io   ar   for   sp   

原文地址:http://www.cnblogs.com/lsyyx/p/4044911.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!