Register | Login
Sunday, May 11, 2008

Sections
  
About Us
  
Hosting Provided by Server Intellect
Partners
Downloads
  
 WWWCoder.com Resource Directory

Search Engine Optimization (SEO) and ASP.NET Developers
3/15/2006 2:46:13 PM

In this article we're going to cover some basic concepts on what you can do in order to make your ASP.NET application as spider and search engine friendly as possible.

If you're developing for the Web then you should familiarize yourself with some Search Engine Optimization or SEO concepts. The idea here is to make your ASP.NET application as friendly as possible for spiders, and the specific spider we're talking about is Google.

In this article we're going to cover some basic concepts on what you can do in order to make your ASP.NET application as spider and search engine friendly as possible.

Postbacks

Your biggest gain in the search engine world is going to avoid the use of postbacks. For example, say you have content within an ASP panel. But in order to display that content you use a button and capture a click event in the code behind, then you change the property of the panel to visible=true once the button is clicked. This will not work with spiders since they don't "click buttons" so to speak. The way to write the page so the spider will work with it is to use a link, and then pass a parameter via a URL, this could be a link back to the page if you want, but then in the Page_Load event check for the parameters values to determine what panel or content to display in your page.

I can't understate the importance of eliminating postbacks when it comes to the Internet. Links are much better when dealing with spiders, avoid the postback, spiders simple can't do them.

Friendly URLs

Another thing to look into is the use of a URL rewriter in order to create spider friendly URLs. There are many examples on the Web for creating a URL rewriter. What a URL rewriter does is translate the parameters over to a directory like structure. For example, mypager.aspx?param1=1&param2=2 becomes something like: /mypage/1/2/default.aspx. This will enhance the spiders efficiency in spidering your site and potentially increase the frequency of a spider doing a deep crawl through your site. You can read evidence of this fact via the Google FAQ:

"Your pages are dynamically generated. We're able to index dynamically generated pages. However, because our web crawler could overwhelm and crash sites that serve dynamic content, we limit the number of dynamic pages we index. In addition, our crawlers may suspect that a URL with many dynamic parameters might be the same page as another URL with different parameters. For that reason, we recommend using fewer parameters if possible. Typically, URLs with 1-2 parameters are more easily crawlable than those with many parameters. Also, you can help us find your dynamic URLs by submitting them to Google Sitemaps. "

There are plenty of resources on the Web for URL rewriting:

Titles and Meta Tags

Another issue when generating dynamic pages, and using the same page but either posting back or linking back via a URL. Be sure to change the Title of the page and Meta description. If you do not do this then Google is going to "think" that it is the same page, and the results will not be displayed as high as you would like. It will definitely affect your search results. One way of tacking this is to convert both the title, and meta description tags to HTML controls and then change the inner text, or dynamically generate the text for the tags when displaying different content.

Here's a sample block of code for dynamically changing the title tag of your Web page:

First modify the page in order to make the title tag a control you can modify:

<TITLE id="PageTitle" runat="server">

Then in your code you first declare the control as an HTMLGenericControl and set the properties:

Protected WithEvents PageTitle As System.Web.UI.HtmlControls.HtmlGenericControl

PageTitle.InnerText = MyValue

As mentioned the meta description tag is also important. For example, say you do a search on keyword contained within the title tag of your document, but not in the body of the document. Google will display the meta description of your site in the results. So if every page within your application has the same meta description value, all the pages are going to look the same, and may not appear to be relevant to the person doing the search.

You can remedy this using the method above or simply populating the value and outputting it to the form:

<META NAME="DESCRIPTION" CONTENT="<%= MetaDescription %>">

Then in the code behind just set the value of MetaDescription

Public MetaDescription As String

MetaDescription = "My meta value...."

Viewstate

Viewstate can be another thing that adversely affects the indexing of your site. For example, if you view the source of an ASP.NET application you may see something like the following:

<input type="hidden" name="__VIEWSTATE" value="dDwtMjA3MTUw...=" />

And the value of this field can continue on for a long time. I've seen cases where the viewstate is over 100k or more. The problem this has with search engines is many times a search engine will rank your page based on where a keyword occurs in the document. For example, say you're searching on ASP.NET and you first have 100k of viewstate and then your keyword appears within the HTML document. This could affect how your page ranks for that keyword since many search algorithms base relavancy on where the keyword appears or how close to the top of the document it appears.

One way, and one I recommend is to remove the viewstate entirely from the source of the HTML page. Not only will this benefit your search engine results, but it will also reduce the download time of the page since your reduce the size of the page.

The following article is shows you how to remove the viewstate, it focuses on DotNetNuke, but you can use the same functions within any ASP.NET application.
http://www.wwwcoder.com/main/parentid/224/site/3507/68/default.aspx

Closing

There are many issues that cover SEO for Websites, but in this article we're covering what you as an ASP.NET developer can address. For more information check out the many sites on SEO by searching on the topic. Good luck in your Web site promotional efforts!

Author Info

Written by Patrick Santry, ASP.NET MVP, MCSE, recognized speaker, and author of several books and magazine articles, and owner of WWWCoder.com. Patrick has over 11 years of Web application development and management. You can visit his blog at http://blogs.wwwcoder.com/psantry/.


Page Options:
format for printing  Format for Printer
email article  Email Page
add to your favorites   Add to Favorites
How would you rate the quality of this content?
Poor - - Excellent
Comments?
Overall Rating:
Comments Left:
Left on 4/24/2008 6:03:20 PM by Anonymous
Comments: I may have a better way of coding the meta tags.
http://seojunkie.wordpress.com/
Left on 4/24/2008 12:07:57 AM by Anonymous
Comments: Meta Tags and Alt tags are the important part of SEO process, this helps a lot. Thank you very much
Left on 3/31/2008 12:59:51 PM by Anonymous
Comments: Very very helpful article
Left on 12/6/2007 8:57:19 AM by Anonymous
Comments: Greate info.

Ray Akkanson
No ratings available.
Left on 11/11/2007 7:52:49 PM by Anonymous
Comments: Hello! Good Site! Thanks you! ohuqqycbfowum
Left on 9/5/2007 1:45:50 AM by Anonymous
Comments: Nice explanation.
Left on 8/7/2007 3:03:46 PM by Anonymous
Comments: I am trying to make my asp.net indexed by google search engine You can see the following link which have a conversation about my problem:http://forums.asp.net/p/1142633/1843517.aspx#1843517
No ratings available.
Left on 7/12/2007 12:46:38 AM by Anonymous
Comments: Good
Left on 7/7/2007 4:22:01 PM by Anonymous
Comments: Great
Left on 7/5/2007 11:27:03 AM by Anonymous
Comments: Sorry i mistyped..

http://www.seo-informer.com
Left on 7/5/2007 11:26:05 AM by Anonymous
Comments: Great article. A company called QualityCube actually has a Visual Studio Add-in that's specifically for doing search engine stuff with Asp.Net. Their site is:
http://www.seo-informer >> if anyone wants to check it out.
Left on 7/5/2007 6:12:49 AM by Anonymous
Comments: good
Left on 5/18/2007 9:47:03 AM by Anonymous
Comments: fff
No ratings available.
Left on 9/4/2006 1:58:06 AM by Anonymous
Comments:
Left on 8/7/2006 3:51:39 PM by Anonymous
Comments: Good points, but old knowledge
Left on 7/31/2006 11:37:34 AM by Anonymous
Comments: Comments from the following blog: Patrick Santry's (aka wwwCoder) Blog, located at: http://blogs.wwwcoder.com/psantry/archive/2006/07/31/42188.aspx
No ratings available.
Left on 7/13/2006 4:12:03 PM by Anonymous
Comments: Ajax is another issue. Since Ajax is generated via client-side scripting, your spiders aren't going to be able to do much with it. You need to make sure you output hard coded HTML on each refresh and be conservative about Ajax use.
No ratings available.
Left on 6/4/2006 12:37:43 PM by Anonymous
Comments: Has anyone ever seen a URL rewriter that can handle the dynamic use of parameters instead of limiting it to a list of rules?
Left on 6/2/2006 2:04:36 PM by Anonymous
Comments: Nice article. Can you elaborate on how you could modify the contents of the meta tag using htmlgenericcontrols? How would I get a hold of the name and content attributes to add my text to?
Left on 5/24/2006 7:39:01 AM by Anonymous
Comments: The articles is kind of ok
No ratings available.
Left on 5/23/2006 3:58:40 PM by Anonymous
Comments: Great content - more please!
No ratings available.
Left on 5/23/2006 1:28:55 PM by Anonymous
Comments: Great content - more please!
Left on 5/23/2006 6:36:10 AM by Anonymous
Comments: In ASP.NET 2 you don't need to do this:
Protected WithEvents PageTitle As System.Web.UI.HtmlControls.HtmlGenericControl

PageTitle.InnerText = MyValue

You can just:
Page.Title = myValue

No ratings available.
Left on 5/22/2006 3:14:44 AM by Anonymous
Comments: Google Site Maps are another method.  They can be hand-coded or generated from nav maps or directory structures.  http://www.google.com/webmasters/sitemaps
No ratings available.
Left on 5/19/2006 10:36:34 AM by Anonymous
Comments: Regarding "Do you have any idea how weblogs work?", that is immaterial given that it is plain-as-day that the links posted are dead. That's my point. I will back up but try to hold on this time-- Dead links are bad, m'kay. If you post dead links, bad things will happen, m'kay. Trackback, Pingback, Hassle-back. Anyway you slice it, a bug is a bug is a bug. Links that work = good. Links that don't work = bad. I will conceed (for the sake of argument0 that you may know more about web blogs that I. Fine. But, I am not (nor was I ever) talking about or professing knowledge of the the inner workings of web blogs. All that I am pointing is one simple thing-- those links don't work and that is not good. It litters the web. Whatever or whoever put them there has made a mistake.
Left on 5/18/2006 2:05:05 PM by Anonymous
Comments: Thank you....
Here is my .net web site

http://avatarkey.com
avatarkey.net
Left on 5/18/2006 9:35:11 AM by Anonymous
Comments: "Automatically added by a script" - Do you have any idea how weblogs work? Do you know what a pingback or trackback is, from your post it looks like you don't.
No ratings available.
Left on 5/18/2006 6:05:37 AM by Anonymous
Comments: i really found this article useful....
it really helped me
Left on 5/17/2006 11:44:40 AM by Anonymous
Comments: Automatically added by a script? That's even worse than I thought. More dead links. Note: The blog comments are automatically added by the site thanks to a pingback script. It's not like they're entering in a link to their blog via the comments form -- ug, even worse, the intervention of "the machines that will be doing our thinking for us"... unfortunately, This link...

http://www.blog-webmaster.com/blogs/sample_weblog/archive/2006/03/29/100.aspx

...is a total deadend; and, this link...

http://developers.ie/blogs/ppabich/archive/2006/05/15/2018.aspx

...is a waste of time because it adds nothing.
No ratings available.
Left on 5/17/2006 1:21:20 AM by Anonymous
Comments: oooops
Left on 5/16/2006 10:36:19 PM by Anonymous
Comments: 2:11:32 - The blog comments are automatically added by the site thanks to a pingback script. It's not like they're entering in a link to their blog via the comments form.
No ratings available.
Left on 5/16/2006 5:24:28 PM by Anonymous
Comments: "Do not optimize until the end." This is a stupid, stupid rule. Maybe I'm not clear on why they put this, but to create a website/database/application etc... and leave all "optimization" to the end is just plain dumb. Also, why is this post even here? This entry is regarding spidering and SEO, has nothing to do with anything signficant.
No ratings available.
Left on 5/16/2006 2:57:47 PM by Anonymous
Comments: If you (or anyone reading this) subscribes to XP, then one should mention a cardinal rule of XP development-- "Do not optimize until the end. Never try to guess what the system's bottle neck will be. Measure it!
Make it work, make it right, then make it fast." -- http://www.extremeprogramming.org/rules/optimize.html
No ratings available.
Left on 5/16/2006 2:11:32 PM by Anonymous
Comments: This "post a link to a blog instead of posting actual comments" stuff is WAY out of control. Half (or more) of those links are dead and they are not even clickable. What the heck ever happened to simply writing a few comments in the textbox? Sheesh, everybody has to be a star and have their own blog-- which, BTW, over half are just empty, junk, or lists of links. More web trash, just what we need. BTW, the article is OK, but a little more details and/or other ways to optimize would be great. Thank you.
No ratings available.
Left on 5/16/2006 1:54:11 PM by Anonymous
Comments: I think we should go back to a plain-text web and all use LYNX. Imagine how fast that would be.
No ratings available.
Left on 5/15/2006 2:23:31 PM by Anonymous
Comments: I don't understand these brainless comments " so much for innovation", what part of the article did you not read. The article clearly states that Viewstate is fine, just load it into memory or place it at the bottom of the page. The article says postbacks are okay, but if you want the content spidered then don't use the postback. You can easily substitute postbacks with querystrings (remember classic ASP?). The writer below speaks of AJAX and makes a great point. AJAX is usually stored on the server side and transmitted via a client action, since it is on the server, the spider can't index the content because of this. The real point of this article is to make developers aware of the issues pretaining to SEO.
No ratings available.
Left on 5/15/2006 1:02:10 PM by Anonymous
Comments: Hmmm. It looks like we are (virtually) back to a HTML-only site. Oh well, so much for innovation.
Left on 5/15/2006 10:33:57 AM by Anonymous
Comments: You're missing the point of the article. The doesn't say "never" to use them, it speaks only to where you want content spidered.

No ratings available.
Left on 5/15/2006 10:11:45 AM by Anonymous
Comments: Some useful tips - but it's a bad thing to encourage people NEVER to use postbacks or the viewstate.  They have their uses and can be extremely powerful.  My advice - use them, but use them wisely.
Left on 5/15/2006 8:03:47 AM by Anonymous
Comments: Comments from the following blog: Pawel Pabich's Blog, located at: http://developers.ie/blogs/ppabich/archive/2006/05/15/2018.aspx
No ratings available.
Left on 5/2/2006 3:21:46 PM by Anonymous
Comments: good stuff
No ratings available.
Left on 4/24/2006 1:16:01 AM by Anonymous
Comments: thank you for your information
No ratings available.
Left on 3/29/2006 4:35:34 AM by Anonymous
Comments: Comments from the following blog: Netah, located at: http://www.blog-webmaster.com/blogs/sample_weblog/archive/2006/03/29/100.aspx
No ratings available.
Left on 3/21/2006 5:28:15 AM by Anonymous
Comments: important for asp.net developer to know abt SEO.

Ashith Raj
No ratings available.
Left on 3/20/2006 8:59:58 AM by Anonymous
Comments: was looking out for SEO tips and tricks in .NET 2.0
thanks

Left on 3/18/2006 2:32:03 AM by Anonymous
Comments: Thanks
Left on 3/17/2006 10:42:07 AM by Anonymous
Comments: Nice, short and useful!
  

 Latest Articles
  

 Latest News
  

 

Spotlight
Syndication

 


 


Digg This
 


DotNetNuke Platinum Benefactor

  
 

 Terms Of Use | Privacy Statement
 Copyright 2006 - Santry Technology Solutions, Box 172, Girard, PA 16417, (814) 414-0252