ASP.NET SEO Tips – how to Optimize SEO on Your ASP.NET Website

SEO has become the most important thing for any website nowadays and as ASP.NET is growing, SEO has become a hot topic among ASP.NET developers.
The world of Search Engine Optimization (SEO) keeps on changing continuously, we can say this as for example can you imagine that last year Google published 450 updates to it’s search engine algorithms?
Though the SEO trend is continuously changing still there are some key points that have been fundamental and unchanged so far.

Here are a few tips on How to optimize SEO on your ASP.NET website. Follow the following directions step by step to seo ASP.NET website:

1. Add descriptive and unique Page Title for every page
Every page in your website should have a unique and descriptive page title that can describe what the page offers. You can set the Page Title either declaratively or in the code behind file. Refer below,

In ASPX,

<%@ Page Language=”C#” AutoEventWireup=”true” Title=”My Home Page” CodeFile=”Default.aspx.cs” Inherits=”_Default” %>

In code behind,

Page.Title = “My Home Page”;

2. Add Meta Keyword and Description tag for every page

Add Meta keyword and Meta description tag with relevant contents. Search engines will use these tags to understand what the page offers. You can dynamically set the meta tags from codebehind file using the below code,

HtmlHead head = (HtmlHead)Page.Header;
HtmlMeta metasearch1 = new HtmlMeta();
HtmlMeta metasearch2 = new HtmlMeta();
metasearch1.Name = “descriptions”;
metasearch1.Content = “my personal site”;
head.Controls.Add(metasearch1);
metasearch2.Name = “keywords”;
metasearch2.Content = “ASP.Net,C#,SQL”;
head.Controls.Add(metasearch2);
The above code will add the below Meta tags to output html.
<meta name=”descriptions” content=”my personal site” />
<meta name=”keywords” content=”ASP.Net,C#,SQL” />

In ASP.Net 4.0, Microsoft added 2 new properties on the Page directive (Page object) that lets you to define the Meta keywords and Description declaratively and dynamically from codebehind.

In ASPX,

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

In codebehind,

protected void Page_Load(object sender, EventArgs e)
{
Page.MetaKeywords = “asp.net,C#”;
Page.MetaDescription = “This is an asp.net site that hosts asp.net tutorials.”;
}

The similar can thing can be achieved in previous versions of .NetFramework by using a custom BasePage class.

3. Unique URL for a Page

Search engines like Google will treat a page with url http://www.example.com/Default.aspx as different from http://example.com/Default.aspx even though they are serving the same page on a website. This may lead to penalize your website for duplicate content issue by the search engine. Hence, always allow single unique URL to identify a page. You can handle this scenario by doing a permanent redirect to one url.

4. Add Alt for images, Title for Anchor

Add ALT text for images and Title for hyperlinks. The ALT text will be displayed when the browser cannot display the image for some reasons. Search engines will not be able to read the image and ALT text will give some hint about the image which the search engine can use.

<asp:Image ID=”imLogo” runat=”server” AlternateText=”My company Logo” ImageUrl=”logo.gif” />
<asp:HyperLink ID=”hpHome” runat=”server” ToolTip=”My Website Home” Text=”Home” NavigateUrl=”Home.aspx”></asp:HyperLink>

The above ASP.Net markup will produce the below output,

<img id=”imLogo” src=”logo.gif” alt=”My company Logo” style=”border-width:0px;” />
<a id=”hpHome” title=”My Website Home” href=”Home.aspx”>Home</a>

5. Build SiteMap

Always have a sitemap file that can guide users and search engines to navigate your site pages easily. It is really necessary to have 2 site maps for a site, an xml sitemap file used by the search engines and an html sitemap file for the website users. Refer here to know more creating xml sitemap for search engines. You can submit your xml sitemap or RSS feed to Google Webmaster tools.

ASP.NET SEO Tips: How to Optimize SEO on Your ASP.NET Website