On-site SEO for ASP.NET Applications

On-site SEO means taking steps to insure that your site is easily crawlable by search engine ‘bots, primarily by Google. Unfortunately, IIS’s default configuration and typical ASP.NET programming practices make the job of optimizing your site for search engines a bit tougher than it is for sites running under LAMP. Fortunately, there are some tools and best practices that will help us and the net/web administrators we work with get around this problem.

Just to give you a quick overview, SEO is divided into two areas, on-site and off-site. On-site SEO involves the structure of your site and how it interacts with search engine ‘bots. Off-site SEO involves how many sites link to your site and how those links are scored. In some cases, how you structure your site and it’s URL formatting can affect how people link to it. From my experience, excellent off-site SEO can mitigate the effects of poor on-site SEO but when both are working together you can make your site have a stronger search engine presence.

Canonicalization Issues

This is the big problem SEO-wise with IIS and ASP.NET systems. Canonicalization in search engine terms means have a single URL that represents the primary version of a page to search engines. Search engine algorithms view the same content on different pages as on-site duplicate content and may flag it as a spamming attempt. With the recent Google ‘Panda’ update that pays closer attention to this factor it’s even more essential to designate a single URL as the primary. Unfortunately, the default configuration of IIS and ASP.NET do things that cause problems in this area. On top of that, common ASP.NET programming practices add to the problem.

The first major problem is that directory pages are accessible via two different URL’s, one for the directory itself and one for the default.aspx page. On top of that, a 301 redirect won’t work since IIS sees these pages as the same even though Googlebot doesn’t.

A second related problem is that while IIS ignores capitalization, search engine bots see different pages. So while default.aspx, Default.aspx and DeFault.Aspx look the same to IIS, ‘bots see them as different pages. So, if someone links to your site using something different than what you intended, this may cause on-site duplicate content issues and possible penalization.

A third problem is will a site use www or not use it. This can also cause pages to be linked incorrectly, internally and externally. This causes “link diffusion”, meaning links don’t get their full value. On top of that, many IIS systems aren’t setup to handle this correctly, resulting in an error page when the wrong URL is clicked.

Another significant canonicalization problem with ASP.NET applications is the use of querystrings to do data passing in the URL. Unlike the other two, this isn’t an IIS issue but a coding issue. For public facing websites, try to keep your URL’s free of large chunks of data. This will insure better crawling by search engine ‘bots and better quality incoming links. Remember, it’s best to always have the page’s primary keyword in the URL before any querystring but this isn’t always possible.

The best way to correct these problems is the use a URL Rewriter plugin for IIS. This will allow IIS to define SEO friendly URL’s prior to handing things off to the ASP.NET engine and can be used to create keyword friendly URL’s in place of querystrings. Unless you’re working in a small organization, this will require the cooperation of the web admin. Sometimes you can get this cooperation but some web admins refuse to allow 3rd party plugins on their web site. So, in that case, you’ll need to use the rel=canonical meta tag to indicate which page should be seen by the ‘bots as the primary page. Here’s what the code would look like in the page’s HTML…

<link rel="canonical" href="http://www.mysite.com/productpage.aspx?item=883101">

While this isn’t the ideal solution, it’s easy to code this into master pages using either standard ASP.NET or new MVC/Razor syntax methods. For more information on using the canonical tag, see this explanation from Google: Specify your canonical

Error Handling Issues

We’ve all seen the familiar ASP.NET error page that comes up when an incorrect URL is entered/clicked or there’s an error in the application. But, did you know that this error page is reached by a 302 temporary redirect by default? This means that search engine algorithms will think that this page is an actual page on your site and continue to attempt to crawl it. This results in more and more crawl errors which can eventually result in a site incurring a penalty and/or having pages removed from the search engine’s index. Of course, this isn’t a desirable outcome.

Fortunately, this problem is easy to correct in the web.config by simply changing the redirectMode attribute to ResponseRewrite rather than using the default setting of ResponseRedirect. Here’s an example…

<customErrors mode="RemoteOnly" defaultRedirect="ErrorPage.aspx" redirectMode="ResponseRewrite">
  <error statusCode="404" redirect="404ErrorPage.aspx" />
</customErrors>

The bad news is that this setting is only available for the 4.0 .NET Framework. So, if you’re using an earlier version of the Framework you’ll have to use an IIS Rewriter to avoid this problem.

Using MetaTags and Optimizing Content

For the best optimization you want to build each page around a particular keyword. So, if you had a site selling shoes and you had a page that sold Nike Air Max+  men’s running shoe you would want everything on that page to reflect that keyword phrase. As I mentioned above, the best thing to do is to find a way to work this into your URL, for example, nike-air-max-men-running-shoe.aspx. But, if you can’t pull this off for one reason or another, you can still optimize on-page content for the target keyword phrase.

First of all, use the <title> meta-tag. Make sure that your target phrase for the page goes into this tag. This is easy to do via code.

The other two major metatags are the description and keyword tag. Neither of these are used by Google, Bing or Yahoo these days to determine the relevance of a page to a search keyword phrase. However, the description metatag is sometimes used as content on the search engine’s result page. Therefore, it’s important to have the description tag filled in with good sales copy. While programmers probably won’t be the ones writing this descriptive content, it’s important for us to communicate this need to the marketing people and to implement it properly on the site.

As you might expect, your page’s content needs to reflect the keyword as well. While a lot of this also goes to the marketing copywriters, it’s important to understand how page design can impact this.

Next, you’ll want to make efficient use of H1/H6 tags. Use them sparingly but use them. Use them to highlight the product keyword. Avoid using them for unrelated headers on the sidebar and the like. Instead, use CSS styling for P, span or div elements in this case.

Avoid having huge chunks of Javascript or CSS code in your pages. Use external files instead for this code. It’s easier to maintain that way and doesn’t make search engine ‘bots dig through a lot of text unrelated to your keyword.

While it’s easy to show different information to different visitors using server side code to determine browser type, geolocation, referrer and so forth, you want to use care in implementing code that would result in showing different information to different users. While there are many legitimate uses for this technique, such as showing different info to mobile vs non-mobile visitors, there is a risk for penalization by search engines should it appear that this is being done to manipulate search engine results. You can usually avoid problems in this area by keeping the basic content the same but only changing the presentation. There are some other techniques that can help but they’re beyond the scope of this article and should be approached with knowledge and due caution. 

If you use AJAX on your site, you may want to check out this information on Google’s Webmaster’s blog on how they spider AJAX sites: A proposal for making AJAX crawlable. Following these guidelines will help make your AJAX and ASP.NET sites more search engine friendly.

You can reinforce the internal relevance of your pages by creating links between related content. For example, your Nike Air Max+ page could link to other Nike products on your site. This related internal linking creates a strong internal link relevancy network and increases the strength of the site as a whole when it comes to a primary keyword, like “running shoes”, as well as many secondary, product specific, keywords.

Site Structure Optimization

In your site structure, it works best to keep your content flow easy for visitors to understand.  The thing is that a good, logical, site structure also works for search engine algorithms as well.

This SEO method is sometimes called the silo method. This means that your content is aligned by specific categories so that it would break down something like this: mens-shoes/nike/air-max. As with related linking, this helps strengthen the overall primary keyword relevance of the site as well longer item specific keywords. In general, a depth of 2 to 5 levels works best both for SEO optimization and visitor usage. In the traditional silo method, there would be no related links outside of the silo, such as tags and related links, but I’ve found that this isn’t as necessary as some of the older writings on this method indicate. In fact, I’ve found on my sites that providing these things to give a better visitor experience and seemed to positively affect search engine performance as well.

Another key element of your site structure is having an XML site map for search engines. It’s essentially a path for the ‘bots to follow so that they can correctly analyze your content. This is easy to generate in code. All you have to do is make sure that this map only contains the canonical links as I noted above. Having an XML site map can really help get a larger site indexed properly. While it isn’t necessary for smaller sites with less than about 1000 pages, it’s not a bad idea to have one if you have time to implement it. For larger sites, especially ecommerce sites, it’s essential to have one that’s kept up to date via code.

Final Thoughts on SEO for ASP.NET

Remember to keep search engines in mind while you’re designing and coding a public facing ASP.NET website. It’s easy for us as ASP.NET programmers who more often work on internal or extranet type sites to overlook the importance of search engine optimization. Don’t fall into this trap. When you’re responsible for creating a public facing site, always bear in mind that search engines are how a lot of the public will be finding your site.

No related posts.

Posted by Frank in ASP.NET
Tags: ,, , , , , ,

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

Theme Provided By Free HTML Layouts