SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 4 down vote accepted

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.

share|improve this answer
excellent, enough there to get me going. – Rob Feb 10 '10 at 15:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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