Dynamic Linking in ASP.NET websites

This article gives a detailed step-by-step guide to configuring both your ASP.NET Web application and your SDL Tridion Content Manager to enable the publishing of pages that contain dynamic links using the new ASP.NET Server Controls introduced in version 5.3 of SDL Tridion R5. Although all this information is available in the standard documentation, it is spread out over several documents. This article brings the information together in one place. To perform this task, follow the numbered steps below.

Presentation Web server configuration

1. Find the Deployer configuration file (it is called cd_deployer_conf.xml and is typically located in the config/ subdirectory of your Content Delivery root location) and open it in a plain-text or XML editor.

2. Edit the file to configure the Deployer to convert TCDL to ASP.NET server controls. Below is an example of the modifications you must make:

<Deployer>
 <Processors>
  <Processor Action="Deploy" Class="com.tridion.deployer.Processor">
   <Module Type="ComponentPresentationDeploy" Class="com.tridion.deployer.modules.ComponentPresentationDeploy">
    <Transformer Class="com.tridion.deployer.TCDLTransformer" />
   </Module> 
   <Module Type="PageDeploy" Class="com.tridion.deployer.modules.PageDeploy">
    <Transformer Class="com.tridion.deployer.TCDLTransformer"/>
   </Module>
   <!-- more modules... -->
  </Processor>
 </Processors>
 <!-- more config... -->
 <TCDLEngine>
  <Properties>
   <Property Name="tcdl.dotnet.style" Value="controls" />
   <Property Name="aspnet.tagprefix" Value="tridion" />
  </Properties>
 </TCDLEngine>
</Deployer>

3. Save and close the configuration file, and restart the Deployer service.

4. Add the following DLL files to the Web site's bin\ subdirectory

  • Tridion.ContentDelivery.WebControls
  • Tridion.ContentDelivery.Linking
  • Tridion.ContentDelivery.Linking.Interop  

5. Register your Web controls in your Web application's web.config file. Here is an example of the modified file:

<configuration>
 <system.web>
  <pages>
   <controls>
    <add tagPrefix="tridion" 
          namespace="Tridion.ContentDelivery.WebControls" 
          assembly="Tridion.ContentDelivery.WebControls" />
   </controls>
  </pages>
 </system.web>
</configuration>

Content Manager Configuration

6. Set your Publication Target Language to ASP.NET

7. Ensure that your templates produce output in the platform-neutral TCDL format by doing one of the following:

  • Output TCDL tags directly, for example: 

    <tcdl:Link type="Component" origin="tcm:128-2234-64" destination="tcm:128-1223" templateURI="tcm:128-1252-32" linkAttributes="" textOnFail="True" addAnchor="False">

    See the Troubleshooting the use of TCDL as an output language section in Content Delivery Implementation Manual (ASP.NET) 5.3.chm for more details on TCDL syntax
  • Use the TCM Script Assistant methods: MakeTcdlComponentLink, MakeTcdlBinaryLink, MakeTcdlPageLink. Refer to the TCMScriptAssistant section in the SDL Tridion R5 Templating and Customization Manual (TOM) (a Windows Help file, extension .chm) for more on these methods. 
  • Write out links in the format: 

    <a tridion:href="tcm:3-123">this is a component link</a> 

Then use the Resolve Links Template Building Block in your compound templates. See the SDL Tridion R5 Templating Manual, section 3.2.h, for more information on attributes you can use for this format. 

Related Links

About the Author
Will Price
Principal Consultant

Will is a seasoned web application consultant having worked on web projects for clients all over the world for the last 14 years. He has a deep technical and functional understanding of SDL Tridion solutions from his 6+ years working at SDL as a Principal Consultant in Amsterdam. Since 2012 he has been working freelance and continues to be involved in SDL Tridion projects.

W.P. Consulting