Question

Has anyone ever managed to implement dynamic master pages on a publishing site?

Something along the lines of the master page switching automatically depending the referrer or some other passed through variable.

E.g. If the referrer was Google use master page “style1.masterpage” or if the referrer was MSN use master page “style2.masterpage” instead.

Was it helpful?

Solution

The Communitiy Kit for SharePoint changes the master page dynamically. You can find a code sample in the latest CKS changset. Drill down to EBE -> CKS.EBE -> CKS.Blog. It is in the BlogHttpModule.cs in the BlogHttpModule_PreInit method. You will need to add the HttpModule to the web.config. For an example of that, check the WebAppFeatureReceiver.cs in the same project.

EDIT: Also, check out this answer for a blog post specific to this solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top