6

We are using DD4T with SDL Tridion 2013.

I am facing an issue with doc and xls files. I have published the files and the files are visible in the broker db. In the website, the links also carry the appropriate relative URL.

When I click the link, it throws file not found exception. In the same page I have PDF, which works completely fine. Is there any routes specific to doc and xls? Because I am getting the following error.

[HttpException]: Page cannot be found

at DD4T.Mvc.Controllers.TridionControllerBase.Page(String pageId)

at IHS.Tridion.ContentDelivery.Controllers.PageController.Page(String pageId)

at lambda_method(Closure , ControllerBase , Object[] )

  • I guess it should be using the BinaryController instead of the PageController for these extensions. This is usually configured in web.config, where those modules are registered - not 100% sure that's the case with DD4T. You probably have some configuration done for PDF already, just try to find where that is and add these extensions there. – Nuno Linhares Oct 23 '14 at 12:31
4

As Nuno suggested in his comment, it's most likely that the doc and xls files are not handled by the binarydistributionmodule. You can configure the file types (extensions) it has to serve by modifying this web.config setting

<add key="DD4T.BinaryUrlPattern" value="^.*\.(jpg|JPG|gif|GIF|doc|DOC|pdf|PDF|png|PNG|mp4|MP4)$" />

As you see, it's a regex that contains a series of extensions. I think by default, it's only set to handle jpg, gif and png files.

A bit of background on this : the urls for these binaries are stored in the broker database in the the BINARYVARIANTS table. However, the default DD4T controller tries to resolve any url not handled by the binarydistributionmodule, and checks if this URL can be found in the PAGE table. As the urls of these binaries are not in the PAGE table, dd4t will then return a 404 not found error.

|improve this answer|||||
  • Thank you very much for the quick reply. It was very informative too. – Vijayaraghavan Oct 23 '14 at 14:08
2

In general it is better to map the DD4T.BinaryUrlPattern to the path where Tridion publishes its binaries (the multimediaurl of the publication) which would look something like

<add key="DD4T.BinaryUrlPattern" value="^/Images/.*$" />

This way you do not accidentally route requests for statically deployed images (maybe you deploy your CSS and background images directly to the web application and not publish them from Tridion?) to the DD4T BinaryDistributionModule.

|improve this answer|||||
  • 1
    that is indeed a valid option as well. You must pay attention though if you publish binaries to different structure groups – Harald Hoffelinck Oct 24 '14 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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