Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have switched a site back to use UI version 3, so this basically works as a 2007 site would.

I would expect that when accessing application pages this would use the application.master in the layouts folder. It doesn't, how do i know this? Well i edited the application.master in the layouts folder with

Hello World

and when i open an application page, the edited application.master is not showing.

Can anyone tell me what master page it is using, driving me a little crazy!

share|improve this question
    
Is it not using the v4.master or default.master from the GLOBAL folder? –  Colin Sep 14 '11 at 9:46
add comment

2 Answers

Are you sure the page you were testing wasn't using the simple.master?

What _layouts page where you using to test?

If you are interested, I wrote a httpmodule for 2007 that would set the applicationpage master to be what the web's master was set to, for the consistant experience: http://www.thelineberrys.com/default-category/using-your-sharepoint-sites-master-page-on-all-application-pages-3.html

I did have to make a change to the code to get it to work as expected in SP 2010 using UIVersion 3 (because with UIVersion 4, there is an option to do this OOTB in your web application general settings).

Below is the new preinit that works with SP 2010:

void page_PreInit(object sender, EventArgs e)
{
    LayoutsPageBase page = sender as LayoutsPageBase;
    if (page == null) return;
    if (page.DynamicMasterPageFile == null) return;

    HttpContext context = HttpContext.Current;
    string currUrl = context.Request.Url.ToString();
    string basepath = currUrl.Substring(0, currUrl.IndexOf(context.Request.Url.Host) + context.Request.Url.Host.Length);
    //Use RawUrl, otherwise it will always use the root web.
    currUrl = context.Request.RawUrl;
    if (currUrl.ToLower().Contains("/_layouts/") &&
        (page.DynamicMasterPageFile.ToLower().EndsWith("default.master") ||
        page.DynamicMasterPageFile.ToLower().EndsWith("custom.master")))
    {
        currUrl = currUrl.Substring(0, currUrl.ToLower().IndexOf("/_layouts/"));
        SPSite site = null;
        SPWeb web = null;
        try
        {
            site = new SPSite(basepath + currUrl);
            web = site.OpenWeb(currUrl);

            if (String.IsNullOrEmpty(web.MasterUrl) == false &&
                web.UIVersion == 3)
            {
                page.MasterPageFile = web.MasterUrl; 
                page.Load += new EventHandler(page_Load);
            }
        }
        finally
        {
            if (web != null)
            {
                web.Dispose();
            }
            if (site != null)
            {
                site.Dispose();
            }
        }
    }
}
share|improve this answer
add comment

master pages are in \14\TEMPLATE\GLOBAL folder.

Try to edit them by SharePoint Designer instead of editing files directly in folder.

share|improve this answer
add comment

Your Answer

 
discard

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.