Home » Articles


Sponsored links

CodeDigest Navigation

Technology News
No News Feeds available at this time.

Community News
No News Feeds available at this time.
SEO Friendly Improvements in ASP.Net 4.0

By Satheesh Babu
Posted On Jan 23,2010
Article Rating:
Be first to rate
this article.
No of Comments: 2
Category: ASP.Net
Print this article.

SEO Friendly Improvements in ASP.Net 4.0


The next version of .Netframework is 4.0, which is currently in its beta 2 stage includes many new ground breaking features. This version of framework will include Asp.Net 4.0, its own version of ASP.Net, includes many new features that take the web development to next level in terms of additional new features and improvements done on the existing framework components.The new features includes some addition of improvements in the area of Search Engine Optimizations.

 In the current internet world, search engines like Google, Bing plays a dominant role to bring your sites new visitors and customers. This made the webmasters and web based companies to invest more in optimizing their web pages to make it more search engine friendly.

 Search engine crawlers will look for as much of information’s to know more about your pages and the products it is offering in order to present your page in front of the users who is searching for it. Hence, apart from offering new features to their users it become vital for web masters to make their websites search engine friendly. Understanding this need, Microsoft shipped some very new good features that are really helpful to make your pages search engine friendly.

Moving forward, we will see some of the new features offered by ASP.Net 4.0 for making your page search engine friendly.

Some of the new features include,

1.      Add MetaKeyword and MetaDescription through Page object

2.      Permanent Redirection

3.      Search Engine Friendly URL’s

We will see more about these features in this article.


Add MetaKeyword and MetaDescription through Page object

Meta tags are special HTML tags that are not displayed to the users but injected to <head> tag for describing the page content. Search engines will use the information in the Meta tags to categorize the contents and to know more about the pages. There are 2 types of meta tags which can be injected to a page to make the search engine understand it.  They are,

1.      Meta keyword

Meta keyword tag should include some keywords of the contents or products the page is offering. For instance, if your page serves for an tutorial it can be something like,

<meta name="keywords" content=".net,, C#, Sqlserver" />


2.      Meta Description

A meta keyword tag can be used to describe the page content or products.

Something like,

<meta name="description" content="The .NET Framework is Microsoft's platform for building applications that have visually stunning user experiences, seamless and secure communication, and the ability to model a range of business processes. " />


Hence, this made the meta keywords and description one of the most important components of a page when we want to make it search engine friendly.

ASP.Net 2.0 introduced a new feature where one can add these tags from the code behind file using HtmlMeta class. It would have been better and easy if we are able to do this through Page directive (Page class).  This will help us to change the meta tags at any time without re-compiling the pages.  ASP.Net 4.0 added 2 new properties on the Page directive (Page object) to let you define the Meta keywords and Description.


<%@ Page Language="C#" AutoEventWireup="true" MetaKeywords=",C#" MetaDescription="This is an site that hosts tutorials" CodeFile="Default.aspx.cs" Inherits="_Default" %>


This can also be done dynamically using Page object from codebehind. Refer the code below,

protected void Page_Load(object sender, EventArgs e)


        Page.MetaKeywords = ",C#";

        Page.MetaDescription = "This is an site that hosts tutorials.";



The above code will add the meta tags in the output html. Refer the below output,




</title><meta name="description" content="This is an site that hosts tutorials." /><meta name="keywords" content=",C#" /></head>



We can still do this in earlier version by defining a BasePage class. Read more here.


Permanent Redirection with HTTP 301 Moved Permanently Response

URL redirection is a technique used in the internet world to let the users know that their pages are permanently moved to different location with a status code 301. The users then will be redirected to a correct page. Mostly, when you change your website to a different domain the users still accessing (from bookmarks, links from other websites) the old domain can be redirected to the new domain using this technique. Search engines like Google will assign the page rank of the old domain to the new redirected domain when it is redirected using this technique. If it is not done in this way then the old domain’s page rank will be fully dropped and a new page rank will be assigned to your new site(With new domain name). Thus, it is always strongly recommended to make your old domain to do a permanent redirection to new domain using this technique.

This technique is not only used for permanent redirect of old domains but also to redirect a domain name without “www” to with www. For example, search engines like Google will treat a page with URL as different from even though they are serving the same page on a website. Thus, there are chances that Google may punish your website with Duplicate Content violations and will remove your site from its index.

Duplicate Content – Since and are treated as 2 different pages, Google will punish you for duplicate content. Google does this for giving good search experience to the users since presenting page with same content on Google search result will not serve the user needs.

Improved Page Rank

Also, the page rank will be assigned to both and and hence making it inaccurate page rank. Hence we need to do a permanent redirect to one URL if the user types a URL without www.


You can either fix your site with www or without www to make permanent redirection. One another alternate way to prevent this issue is by setting preferred domain with Google Webmaster tool. Also, if you have duplicate contents in your websites (separate printer friendly pages, etc) then you can use a technique called canonicalization which offers you some handful of solutions to prevent the duplicate content issue easily, apart from the above.


Thus, when we move our internet page to a different location, it is always required to send “HTTP 301 Moved Permanently” response to the search engines to hold back the page rank by redirecting to the new page. Understanding this need 4.0 includes a new method to do redirection called RedirectPermanent() to do this easily.

Refer below,


Response.RedirectPermanent("new url")


Search Engine Friendly URL’s

Routing is a technique where webforms can be accessed with a friendly and descriptive URL’s.  Hence, the ugly URL’s with querystring can now be converted to a meaningful and descriptive which will be easy to remember and will improve the search engine rank.

For example a url like,

http://localhost/Shopping/productlist.aspx?CatID=C91E9918-BEC3-4DAA-A54B-0EC7E874245E is not friendly enough to more about it.

As you can see, the above URL is not readable and descriptive to understand the purpose it is going to serve. When we use routing in these scenarios we can make the URL more descriptive, readable, predictable and most importantly search engine friendly and also human friendly. Something similar to,


The above URL speaks itself i.e. it is intended to display a list of mobile phones in electronics category. Since search engine will look for every thing to know about the page, the urls also will help identify the page contents and thus making it search engine friendly.

Read Rangan’s post on routing in ASP.Net 4.0 here.


Read Search Engine Friendly URL’s Using Routing in ASP.Net 3.5



Since search engine became major source of traffic for a website, it is required to make the sites we develop search engine friendly. Thus, Microsoft included some of the good features with ASP.Net 4.0 that can make our life easier to do search engine optimization of our website.

Webmasters and site owners invest a significant amount of time to achieve the above features in previous versions of ASP.Net. For example, with URL rewriting techniques we can achieve the SEO friendly URL’s, etc. But ASP.Net 4.0 new features allow webmasters and site owners to concentrate on adding new site features by making SEO optimization easier.

Happy coding!!



Similar Articles
You can contribute to CodeDiget.Com:
Donate to
Article Feedback
The voice of raatint
The voice of raatintlioy! Good to hear from you.
you are the genious
codedigest rocks...i cant explain in words how valuable your post is...thanks a ton.. bookmarked by me and with my friends..