I am trying to fetch the DCP in DXA .NET application. I found some link where it has been mentioned to use ContentProvider.GetEntityModel() but it takes a Localization as input. So always it takes the publication ID of the Publication where the Web url is linked.

My requirement is to fetch the DCP from other Publications as well, like ComponentPresentationFactory.TryGetComponent(componentTcmId, CTTcmId); Where I can instantiate ComponentPresentationFactory with respective Publication ID?

Or is there any way to customize the WebRequestContext to point to other web Publication dynamically?

2 Answers 2


WebRequestContext.Localization is indeed the context Localization/Publication per definition.

However, you can obtain other Localizations using SiteConfiguration.LocalizationResolver.GetLocalization(); it takes the Localization ID (i.e. the first number from the TCM URI) as input.

You can then pass in the obtained Localization object to the GetEntityModel method.

  • This fits more as per my requirement. Thanks.
    – Manas.p
    Commented Jul 29, 2020 at 7:11

DXA is built on top of DD4T, so the underlying APIs are the same. We should be able to use the standard Content Delivery API to get DCPs. Using the ComponentPresentationAssembler class and passing the publication ID in the constructor, we should be able to get DCPs based on publications. Something like this should work:

ComponentPresentationAssembler componentPresentationAssembler = new ComponentPresentationAssembler(19);
String content = componentPresentationAssembler.getContent(2049, 2050);
  • Thanks for the suggestion. But I want the result as Component class .This will provide the output as a string and then I have to transform the string into proper format.
    – Manas.p
    Commented Jul 27, 2020 at 15:50
  • The result is a JSON. So not a big effort to serialize the string. Thanks
    – Manas.p
    Commented Jul 27, 2020 at 16:57

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.