ASP. NET 4.0 Seo enhancement 1: Use metadegion, metakeywords, redirectpermanant, etc.

Source: Internet
Author: User

Today's websites are paying more and more attention to Seo, and many companies are doing seo optimization. In other words, Seo can bring benefits to website owners and improve Seo, you can bring more traffic from search engines without having to pay for advertising. In view of this ASP. net4.0 has made some optimization work on Seo.

1. metadescription, metakeywords specifies the meta description and keyword tag of the page.
You can specify the following in the page command of the aspx file:

 
<% @ Page Language = "C #" autoeventwireup = "true" codebehind = "default. aspx. CS "inherits =" outputcachetest. default "metadeworkflow =" I am the page description "metakeywords =" key word 1, key word 2 "%>

It can also be specified in the CS file, for example:

 
Protected void page_load (Object sender, eventargs e) {metadeworkflow = "this is a test"; metakeywords = "Asp.net 4.0, cache ";}

2. Use response. redirectpermanent to tell the search engine that the current address has been permanently redirected.

The redirectpermanant method and the redirecttoroutepermanent method are added to httpresponse. Both methods can implement 301 redirection to tell the search engine that the currently accessed content has been permanently moved to another address.ProgramIt is very useful when modifying URL rules. The following is an example:

Protected void page_load (Object sender, eventargs e) {// redirect to an address response. redirectpermanent ("http: // somedomain/somepath");} protected void page_load (Object sender, eventargs e) {// redirect to routingurl response. redirecttoroutepermanent (New {controller = "test", Action = "details", id = "2 "});}

3. In. Net 4.0, both the radiobuttonlist and checkboxlist server-side controls support the use of UL or ol labels for output, for example

 
<Asp: checkboxlist runat = "server" id = "list" repeatlayout = "orderedlist"> <asp: listitem value = "1"> Beijing </ASP: listitem> <asp: listitem value = "2"> Shanghai </ASP: listitem> <asp: listitem value = "3"> Tianjin </ASP: listitem> <asp: listitem value = "4"> Chongqing </ASP: listitem> </ASP: checkboxlist>

Output

<Ol id = "list"> <li> <input id = "list_0" type = "checkbox" name = "list $0" value = "1"/> <label = "list_0"> Beijing </label> </LI> <li> <input id = "list_1" type = "checkbox" name = "list $1" value = "2 "/> <label for =" list_1 "> Shanghai </label> </LI> <li> <input id =" list_2 "type =" checkbox "name =" list $2 "value =" 3 "/> <label for =" list_2 "> Tianjin </label> </LI> <li> <input id =" list_3 "type =" checkbox "Name =" list $3 "value =" 4 "/> <label for =" list_3 "> Chongqing </label> </LI> </OL>

 

Reading about new features of Asp.net:

1. Start with the page tag <%>
2. in ASP. NET 4.0, you can use a custom provider for outputcache.
3. Enhanced Seo support for metakeywords, metadegion, and redirectpermanant
4. Seo-enhanced URL Routing
5. Output more pure HTML code, viewstatemode, clientidmode, checkboxlist, etc.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.