ASP.NET4.0 新功能之 SEO 增强
作者:孟宪会 发布日期:2010-01-06 09:16:32

ASP.NET4.0提供了一系列新的特性实现网站的 SEO优化,包括:

  • Page类的新属性:Page.MetaKeywords 和 Page.MetaDescription;
  • ASP.NET Web Forms 新的URL路由功能;
  • Response.RedirectPermanent()、Response.RedirectToRoutePermanent()方法等。


Page.MetaKeywords 和 Page.MetaDescription属性将生成  html 标记中的<meta name="description" content="" /> 和 <meta name="keywords" content="" />,例如

C# 代码
Page.MetaDescription = "ASP.NET 4.0学习站点:http://dotnet.aspx.cc/";
Page.MetaKeywords
= "孟宪会";

将生成如下的代码:
HTML 代码
<meta name="description" content="ASP.NET 4.0学习站点:http://dotnet.aspx.cc/" />
<meta name="keywords" content="孟宪会" />
详细信息可以参考:
http://msdn.microsoft.com/en-us/library/system.web.ui.page.metakeywords%28VS.100%29.aspx
http://msdn.microsoft.com/en-us/library/system.web.ui.page.metadescription%28VS.100%29.aspx

Response.RedirectPermanent()将进行HTTP 301(Moved Permanently)重定向。

原文地址:http://dotnet.aspx.cc/article/db3bb1f7-7bb5-4761-a03e-ca4a4a371399/print.aspx
© 版权所有 【孟宪会之精彩世界】TM 2012