1

Is it possible to get the URL of pages where a dynamic component has been used, i.e. to resolve a URL at run time of a dynamic component.

Here is the exact scenario which I am referring to in my solution. https://tridion.stackexchange.com/a/7803/2948

Detailed Question: A schema with a dynamic component templates i.e. CT(Allow on Page Using Dynamic Assembly), I want to generate a list of such dynamic component with a url redirecting user to its detail page(with static CT).

Progress Till now: Created a list of dynamic component, but without URL.

Need to have a way where user can go to the detailed page where a particular dynamic component has been used

1
  • 1
    Have you tried using CD Linking APIs to resolve the Component IDs to Page URLs? Commented Aug 13, 2019 at 20:04

1 Answer 1

1

For those having similar issue:

using Sdl.Web.Common.Configuration; //namespace for SiteConfiguration
string UrlOfDynamicComponent=string.Empty;
try
{
string TCMURI= "tcm:" + WebRequestContext.Localization.LocalizationId + "-" + ComponentURI;
UrlOfDynamicComponent = SiteConfiguration.LinkResolver.ResolveLink(TCMURI); 
}
catch
{
UrlOfDynamicComponent =string.Empty;
}

The string returned will be a url(if found any) or a null string.

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.