Sometimes, we get a requirement to protect media files by showing a disclaimer, which means we need to put a disclaimer before viewing any media file to prevent abuse by setting governing laws, owning the content, protecting documents from search engines, and so on. In such cases, the user will first agree to the disclaimer and then will be able to view the media documents.
In this recipe, you will learn showing disclaimers on media items using MediaRequestHandler
.
We will first create a Disclaimer Content
Page, which will be opened when a user opens a protected media item:
Create a
Disclaimer Page
template with two fields,Title
andDescription
. Create a content page,/Home/Privacy-Disclaimer
, using this template.Create another
Disclaimer Settings
template with two fields,Media To Protect
as Treelist andDisclaimer Page
as Droptree. Set the Media To Protect field source to an appropriate media path, for example,/sitecore/media library...