ASP.NET websites need Search Engine Optimization too!
I found that there is not much information available on the Net about how to optimize
your ASP.NET pages so that they may be found on Google.
Here are a few tips:
- Use the System.Web.UI.HtmlControls.HtmlMeta class for meta headers. Initialize,
set the value and add to page.header.controls.
protected void Page_Load(object sender, EventArgs e)
{
CreateMetaTags();
}
private void CreateMetaTags()
{
System.Web.UI.HtmlControls.HtmlMeta
metaAuthor = new HtmlMeta(),
metaCopy = new HtmlMeta(),
metaDate = new HtmlMeta(),
metaBots = new HtmlMeta(),
metaKeywords = new HtmlMeta(),
metaDesc = new HtmlMeta(),
metaName = new HtmlMeta(),
metaGen = new HtmlMeta();
metaAuthor.Name = "Author";// Author
metaAuthor.Content = "Deep J."; metaCopy.Name = "Copyright";//
Copyright
metaCopy.Content = "Copyright " + DateTime.Now.Year.ToString() + "
Noble River Ventures"
metaDate.Name = "Date";// Date
metaDate.Content = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss");
metaBots.Name = "robots";// Robots
metaBots.Content = "all";
metaDesc.Name = "Description"; // Description
metaDesc.Content = " Keyword Research Explained . Free Search Engine Optimization
Information. Tips, Tricks, Tools, Blogs, Articles. Updated every day. You need to
go nowhere
else for your SEO updates... ";
metaKeywords.Name = "Keywords";// Keywords
metaKeywords.Content = "Search Engine Optimization Tools | ASP.NET Coding |
SEO | Search Engine Optimization | Programming ";
this.Page.Header.Controls.Add(metaAuthor);
this.Page.Header.Controls.Add(metaCopy); this.Page.Header.Controls.Add(metaDate);
this.Page.Header.Controls.Add(metaBots);
this.Page.Header.Controls.Add(metaDesc);
this.Page.Header.Controls.Add(metaKeywords);
this.Title = "Search Engine Optimization Tools, Tips, Tricks, Articles and
Blogs.";
}
}
- Use this.Title = “Title here”;
- For Anchor tags, use this format <a runat=”server” href = “~/Folder/FileName.aspx”>link
text </a> . The runat=”server” part is most important or else, maintaining
your link integrity is a headache.
- If you use SessionIds, try not to do that via the querystring. If on separate tries,
the spider sees different URLs, it may take them as different pages. Of course,
later on it may flag all those other pages as duplicate, but your bandwidth is wasted
unnecessarily.
- Put your links on the Master page so that the same links are available from every
page. Add additional links to your important pages from the body copy.
-
Postbacks are not very good for SEO. If you are displaying content only on
the click of a button or some other user action, the content may not be available
to the spider.
- Avoid the use of hyperlinkbuttons. They include javascript code instead of
actual links that may or may not be read by the spider. Use regular anchor tags
as in point 3 above.
- Do not put the link to the copyright notice(or web-designer email) on the Master
Page. It gets copied on every content page and takes away from the ranking of other
links. If you must, make sure the spider does not follow it by using rel=”nofollow”.
- Viewstate. This is a problem if you are trying to optimize pages with a lot of dataentry
objects like text boxes and dropdowns. ASP.NET creates a hidden variable and posts
it back to the page with a lot of encrypted data that stores the state of the controls
on the page. Spiders may find the keywords way down on the page, and your
keyword density may also suffer because of the added viewstate data. This
is not often an issue with regular text only pages.