SEO For ASP.NET Web Sites
One of the main sources of audience for these internet applications are the Search Engines like Google, Bing, Yahoo etc. Hence, the end application should not only handle your business problems efficiently but also follow some simple rules so that it yields good results in internet arena. This article, will list some of the simple guidelines which you need to consider if your Asp.Net application is an internet site.
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,
<%@ Page Language="C#" AutoEventWireup="true" Title="My Home Page" CodeFile="Default.aspx.cs" Inherits="_Default" %>
In code behind,
Page.Title = "My Home Page";
4. 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";
metasearch2.Name = "keywords";
metasearch2.Content = "ASP.Net,C#,SQL";
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.
<%@ 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" %>
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 .Net Framework by using a custom BasePage class.
5. Make descriptive urls
Make your website URL descriptive. URL’s that has lots of query string values, numeric ids are not descriptive. It will provide enough information what the page offers. For example, http://www.example.com/products.aspx?catid=C91E9918-BEC3-4DAA-A54B-0EC7E874245E is not descriptive as http://www.example.com/Windows-Hosting
Apart from other parameters, search engines will also consider the website url to match your page for a searched keyword.