I have a Page with an anchor tag on my web site. When I open this in an editor it shows me the following:

<tridion:ComponentLink runat="server" 
                       LinkAttributes=" " 
                       TextOnFail="true" />

When I open this in a browser it shows:

<a href="http://localhost/abc/xyz/pageholdingcomponent4-4.aspx?ComponentId=20957&amp;SourcePageId=20974">

how to resolve this query string so that on click the respective Component Page gets displayed?

  • Please read the information in the help center on how to properly format code so you can use < and > characters which makes your question a lot more readable. It can also help to edit this question and see the changes I made for you. Apr 8, 2014 at 9:00

2 Answers 2


Check your cd_link_conf.xml, chances are that someone changed the defaults and you have this enabled:

<Linking ComponentAnchors="true" AddComponentLinkInfo="true"/>

By default these values are either set to false or this element is commented out altogether. I never used this, but think what you're seeing is consistent with what this should do.


I would find it very strange if the tridion:ComponentLink tag you described in your question would resolve in a link with a query string, since that is not standard behavior of the Dynamic Linking Server Control.

Even if you would set the AddAnchor="false" attribute to the value true, you would not get a query string, but something like #1 added to your link url (where the number in question reflects the position of the Component Presentation on the Page that you are linking to).

So you either have customized the Dynamic Linking Server Control or I'm completely misunderstanding your question. But let me try to give something of an answer anyways, who knows it is spot on.

When using Broker queries I usually have it format my links with the TCM URI of the Component I want a detail representation of. For instance on my product lister page I list all products found via a broker query and that results in links like product.aspx?uri=tcm:6-317.

On my product detail page (product.aspx) I have a user control which looks something like this:

<custom:ProductDetail ID="product_detail" runat="server" 
                      publication="tcm:0-6-1" />

The Template and Publication ID as set in there at publishing time to give the correct context.

Now in the code behind of this control I have the following which uses the supplied information (the attributes in the control and the uri in the query string) to get me the correct Component Presentation from the Broker:

protected void Page_Load(object sender, EventArgs e)
    string templateUri = Attributes["template"];
    string publicationUri = Attributes["publication"];

    string componentId = HttpContext.Current.Request.QueryString["id"];
    string componentUri = HttpContext.Current.Request.QueryString["uri"];

    if (!string.IsNullOrEmpty(componentId) && string.IsNullOrEmpty(componentUri))
        // tcm:0-x-1
        int publicationId = int.Parse(publicationUri.Split('-')[1]);

        componentUri = string.Format("tcm:{0}-{1}", publicationId, componentId);

    using (ComponentPresentationAssembler cpa = new ComponentPresentationAssembler("tcm:0-0-0", Page))
        ProductDetailPlaceHolder.Text = cpa.GetContent(componentUri, templateUri);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.