Asp.Net4.0/VS2010新變化(4):SEO的改進

來源:互聯網
上載者:User

標籤:des   style   blog   http   color   io   ar   for   sp   

asp.net4.0的webform中,對於Page對象新增加了二個屬性:MetaKeywords,MetaDescription 

後端代碼上,寫法也更簡單,以前可能需要這樣寫:

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

現在可以直接這樣寫:

?
12 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的改進

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.