Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1061913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:32:41+00:00 2026-05-16T18:32:41+00:00

I’m trying to do dynamic switching of the master page in SharePoint 2007 publishing

  • 0

I’m trying to do dynamic switching of the master page in SharePoint 2007 publishing site.

I’m following this example which uses a HTTP Module

http://ranaictiu-technicalblog.blogspot.com/2009/10/sharepoint-dynamically-change-master.html

Here is my code

public class SwitchMasterPage : IHttpModule
{
    public void Dispose()
    {

    }
    public void Init(HttpApplication context)
    {
        context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);
    }

    void context_PreRequestHandlerExecute(object sender, EventArgs e)
    {
        Page page = HttpContext.Current.CurrentHandler as Page;
        if (page != null)
        {
            page.PreInit += new EventHandler(page_PreInit);
        }
    }

    void page_PreInit(object sender, EventArgs e)
    {
        Logger.Verbose("SwitchMasterPage:page_PreInit", "I'm in the preInit event.");
    }
}

Everything is working fine when the current page type is an Application Page, however when the page type is a Publishing page (e.g. BlueBand.master) the page_PreInit procedure is never called – it is still being registered with the event handler though.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:32:42+00:00Added an answer on May 16, 2026 at 6:32 pm

    oh yes!

    http://webcache.googleusercontent.com/search?q=cache:SVA_9XSp1lwJ:www.pings.dk/blog/archive/tags/Master%2520page/default.aspx+spcontext.current.web.custommasterurl&hl=en&gl=uk&strip=1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create dynamic menus from the database using the following example
I am trying to create a dynamic web page which requires no post back
I am trying to add dynamic form fields to jsf form. But even following
I'm trying to create dynamic graphics for my game, which I'm building with Cocos2D.
i am trying to generate dynamic array as foreach($this->data['Carcase'] as $key=> $value) { if(!empty($value))
I am trying to create dynamic subdomains in .htaccess. I want something like this:
I am trying to understand dynamic linq as used by Scott Guthrie in this
i'm trying to use dynamic typing in Obj-C, i've got following code and errors:
I'm trying to create dynamic tables in my registration page and I've given up
I'm trying to make dynamic text scroll on the page. I want it to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.