Monday, November 22, 2010

SEO - New Features in ASP.NET4

New features in ASP.NET 4 for search engine optimization.
  1. Page.MetaKeywords and Page.MetaDescription properties
  2. URL Routing support for ASP.NET Web Forms
  3. Response.RedirectPermanent() method
Page.MetaKeywords and Page.MetaDescription properties


Now with ASP.NET 4 web forms we can easily add MetaKeywords and MetaDescription in code behind classes. We can now set keywords and description programmatically.
 Below is a simple code snippet that demonstrates setting these properties programmatically within a Page_Load() event handler


In addition to setting the Keywords and Description properties programmatically in your code-behind, you can also now declaratively set them within the @Page directive at the top of .aspx pages.  The below snippet demonstrates how to-do this:



URL Routing support for ASP.NET Web Forms

URL routing was a capability we first introduced with ASP.NET 3.5 SP1, and which is already used within ASP.NET MVC applications to expose clean, SEO-friendly “web 2.0” URLs.  URL routing lets you configure an application to accept request URLs that do not map to physical files. Instead, you can use routing to define URLs that are semantically meaningful to users and that can help with search-engine optimization (SEO).
For example, the URL for a traditional page that displays product categories might look like below:
http://www.mysite.com/products.aspx?category=software
Using the URL routing engine in ASP.NET 4 you can now configure the application to accept the following URL instead to render the same information:
http://www.mysite.com/products/software
Response.RedirectPermanent() method
It is pretty common within web applications to move pages and other content around over time, which can lead to an accumulation of stale links in search engines.
ASP.NET 4 introduces a new Response.RedirectPermanent(string url) helper method that can be used to perform a redirect using an HTTP 301 (moved permanently) response.  This will cause search engines and other user agents that recognize permanent redirects to store and use the new URL that is associated with the content.  This will enable your content to be indexed and your search engine page ranking to improve.
Below is an example of using the new Response.RedirectPermanent() method to redirect to a specific URL:


ASP.NET 4 also introduces new Response.RedirectToRoute(string routeName) and Response.RedirectToRoutePermanent(string routeName) helper methods that can be used to redirect users using either a temporary or permanent redirect using the URL routing engine.  The code snippets below demonstrate how to issue temporary and permanent redirects to named routes (that take a category parameter) registered with the URL routing system.


 
 

No comments:

Post a Comment