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.

1 Answer 1


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.

  • excellent, enough there to get me going.
    – Rob
    Commented Feb 10, 2010 at 15:09

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.