Google, Microsoft and Yahoo announced support for a new "canonical" link element in the header of a page that will help clean-up duplicate url's that have been indexed from your site.
The canonical link for this page, for example, would be:
<link rel="canonical" href="http://guyellisrocks.com/coding/adding-a-canonical-link-element-in-asp-net/">
To add this link tag to your header tag programatically using C# add the following to your Page_Load() function:
protected void Page_Load(object sender, EventArgs e)
{
HtmlLink link = new HtmlLink();
link.Attributes.Add("rel", "canonical");
link.Attributes.Add("href", "http://guyellisrocks.com/coding/adding-a-canonical-link-element-in-asp-net/");
this.Header.Controls.Add(link);
}
Canonical url is very important. Now specially for google page rank.
ReplyDeletewww.ommrudraksha.com
It rocks. Very good work.
ReplyDeleteIt is good to know that Canonical HTML Link tags (and other tags, i.e. Meta and CSS Links) can be added dynamically from the C# source code.
ReplyDeletemy developer use this format in asp.net at the end of canonical, could you please tell me if this is correct ....com"></link>
ReplyDelete