ASP. NET 4 includes a series of new runtime features that can help you further optimize your website. Some of the new features can be used for Seo optimization to improve the ranking and weight of websites in search engines. These features include:
New Page. metakeywords and page. metadeworkflow attributes
New URL-oriented support for ASP. NET web forms
New response. redirectpermanent () method
The following describes how to use these features to further improve the relevance of search engines.
Page. metakeywords and page. metadeworkflow attributes
A simple suggestion for improving the relevance of Web search is to make sure that you always output the related "keywords" and "Description" in the
A good improvement in ASP. Net 4 web forms is that two new attributes are added to the page class: metakeywords and metadegion, which enableCodeYou can use programming methods to set these values more easily and cleanly.
The
The following is a simple code snippet that demonstrates how to set these attributes programmatically in the page_load () event handler function:
In addition to setting the keywords and description attributes in the background code, you can also set them in the declaration method in the @ page command at the top of the. aspx webpage. The following code snippet demonstrates how to do this:
As expected, if you set these values programmatically, they will replace any value declared in the
URL orientation in ASP. NET web forms
URL orientation is the first step in ASP. net 3.5 SP1, which is already ASP. net MVC application, to show clean, Seo-friendly "Web 2.0" URL. URL orientation allows you to configure an application to accept request URLs that are not mapped to physical files. You can use orientation to define URLs with more semantic meanings for users, these URLs help search engine optimization (SEO ).
For example, the URL of a traditional web page displaying product categories may look like this:
Http://www.mysite.com/products.aspx? Category = Software
Using the URL-oriented engine in ASP. NET 4, you can now configure the application to accept the following URL to display the same information:
Http://www.mysite.com/products/software
In ASP. NET 4.0, URLs like above can now be mapped to ASP. net mvc controller classes, or to Web Pages Based on ASP. NET web forms. You can even have an application that contains both web forms and MVC controllers, using a single set of guiding rules to map URLs between them.
Response. redirectpermanent () method
With the migration of time, it is extremely common to move webpages and other content between Web applications, but it will lead to the accumulation of invalid links in search engines.
In ASP. NET, developers often use the response. Redirect () method to convert requests from old URLs to new URLs. But what many developers do not realize is that response. the redirect () method sends an HTTP 302 found (temporary redirection) reply, leading to excessive HTTP round-trips when the user attempts to access the old URL. A search engine generally does not follow multiple redirection directions, which means that using a temporary redirection will negatively affect your webpage ranking.
ASP. NET 4 introduces a new response. redirectpermanent (string URL) helper method, which can be used for HTTP 301 (permanent redirection) redirection. This will lead to identification of permanently retargeted search engines and other user proxies to save and use the new URL associated with the content. This will index your content and increase your search engine page ranking.
The following is an example of using the new response. redirectpermanent () method to redirect to a specific URL:
ASP. net 4 also introduced a new response. redirecttoroute (string routename) and response. the redirecttoroutepermanent (string routename) auxiliary method can be used to perform temporary or permanent redirection through the URL-oriented engine. The following code snippet demonstrates how to send a temporary and permanent redirection to a named path registered in the URL-oriented system (this path accepts a category parameter ).
You can use the above path and method for URL Based on ASP. NET web forms and ASP. net mvc at the same time.
Conclusion
ASP. NET 4 contains numerous feature improvements to facilitate the construction of an exclusive Seo-oriented public website. You should be able to use these features to increase the user traffic on your website, hoping to directly or indirectly increase your income.