Branding application pages
One thing that is kind of a gotcha when it comes to rebranding your SharePoint sites is application pages. If you have just rebranded your web site either by creating new CSS styles sheets and wiring these to the existing default.master or indeed created your own master page any application pages won’t be rendered using your new styling. Why?…
Application pages live in the 12 hive ‘layouts’ directory and is available to ALL sites in your farm via a virtual directory called _layouts. Application pages don’t use the master pages specified within the site, they use their own master page called application.master and this too lives in the layouts directory.
If you go branding the application.master page directly then this is going to change and effect all your sites in your farm. A better approach would be to determine what master.page to use during the page load life-cycle.
So for the project I’m working on at the moment I really only need to brand the ‘file upload’ pages which are used by the users from the standard document library options menu. So, although this is unsupported by Microsoft’, I have little option but to modify the upload.aspx application page directly. Again you can find this in the layouts folder.
As long as you fully document this change and ensure your change control places check this during any future SharePoint software updates released from Microsoft you will be fine.
Look for the ‘PlaceHolderAdditionalPageHead’ content place holder then add the following code…
protected override voidOnPreInit(EventArgs e)
//Call the base class method first
//Dynamically change the MasterPageFile to the current sites
MasterPageFile = SPContext.Current.Web.CustomMasterUrl;