By Edith Colegio
When it comes to SharePoint site branding, you think about styles, pages library, web parts, etc. But then you realize your site has another “side”… the “_layouts” section where it involves all pages: 1) People and groups (site permissions), 2) All site content, 3) Site settings, and all of them use a different masterpage than the rest of your site!
Then you think you can “customize” those pages with a simple modification to your “Application” master page (using your site’s theme of course). That’s not as easy as it looks. According to Microsoft there are two ways to modify/customize the application.master page:
1. Modify the application.master page in the 12 hive. This means use the ONLY application.master file on the Core, and change it!!! So, if you’ve been reading the best practices about SP, you’ll know you are NOT supposed to modify files in the 12 hive.
2. Create a custom layouts Virtual directory. You need to copy the whole layouts folder to do this! Imagine maintenance!
So the next option is a non-supported approach, but my favorite: use HTTP modules!
Http modules intercept page requests and allow custom code to run before the page actually renders. Thus, we can intercept the request and check if it is an application page. Then we can change the master page reference dynamically as the page renders.
To achieve this, follow these steps:
1. Create a new VS project (Class Library project) and call it HttpModule
2. Rename Class1 to ChangeApplicationMaster and add the following code to it:
1. Sign and build the project, then place the dll in the GAC
2. Go to your site’s virtual directory location (usually at c:\Inetpub\wwroot\wss\VirtualDirectories\SITENAME)
3. Add the next line to your web.config within the “httpModules” section:
<add name=”HttpModuleChangeAppMaster” type=”HttpModule.ChangeApplicationMaster, HttpModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ei8798sad32jkd873″ />
4. Copy your application master page (the one on the 12 hive) file to your site’s Master page’s Gallery (go to Site settings, Master Pages) and make sure you call the file “CustomApplication.master” so your code renders this file.
5. That’s it, you have your own application masterpage running now J and you can customize it with SP Designer, or any other web editor.
Just try to keep all content place holders intact, in order to avoid unexpected errors on rendering the content.
Hope this helps!