how to add cannonical tag for ASPX .NET page

- 1 answer

Ad

How could I set a cannonical tag for .NET (aspx) web pages that use master pages?
based on the SEO test, our site fails on the canonical test. we are using a 3rd party hoster (win server) and don't have access to root server!

I added the following snippet to my domain.com/default.aspx page

HtmlLink seoTag = new HtmlLink();

    seoTag.Attributes.Add("rel", "canonical");
    seoTag.Href = "http://www.domain.com/";
    Header.Controls.Add(seoTag);

but that didn't help!

Appreciate your feedback.

Ad

Answer

Ad

Try to add this in the aspx (html code)

<link rel=”canonical” href=”http://example.com/page.html”/>

source

Ad
source: stackoverflow.com
Ad