Start learning SharePoint now!


View up and coming events.

Contact Us

We would love to hear from you!

SharePoint 2007, ** CAUTION ** Editing Application.Master (or any _layouts files)

By shane.perran in : SharePoint 2007 // Aug 30 2006

This post is simply to avoid the invetiable.  As time goes on more and more people will attempt edits of their application.master page as well as other pages within the _layouts directory.

Before you do be make sure you fully understand the possibile consequences, some important things to realize are listed below:

1) Microsoft does not support editing default (file system) pages, they can easily be overwritten during updates, patches etc.  Please make sure everyone (This includes management, developers, customers – everyone) is aware of this.

2) SharePoint Designer 2007 can and does make automatic changes to page tokens and references which can break pages within your _layouts folder.  In the event that you find yourself starting at an error after editing your application.master page in SPD, now you know why.  Check the page changes (at the top of the page).

For those that have no fear and realize the potential threats editing these pages cause, please make sure you have a VERY solid back-up story and that it’s followed.

This post was mostly to point out the fact that SharePoint Designer 2007 does make automatic changes to pages without your knowledge – these changes can and do break the pages within the _layouts folder on the servers file system.  Hopefully there will be options for “no automatic” code changes, or “warn before all” in the final builds. 

About the Author

shane.perran has written 606 articles for SharePoint Nation.

25 Responses to "SharePoint 2007, ** CAUTION ** Editing Application.Master (or any _layouts files)"

  1. superfly January 17, 2007 12:06 pm


    I have not been able to find application.master in SPD 2007. Does it exist in SPD or do you modify it at the file system level in the layouts folder?

  2. shane January 17, 2007 12:27 pm

    Be very aware of the following:

    1) You should be very aware of the fact that modifying the application.master is “NOT” supported by Microsoft, as is the case for all default (out of the box) files residing on the file system.

    2) Opening/Saving ANY file in the _layouts folder using SharePoint Designer 2007 will result in page/token changes which will cause the page to stop functioning, and to display an error.

    3) You are correct in thinking that it’s located in the _layouts folder of the file system.

  3. superfly January 17, 2007 12:41 pm

    I hope Microsoft corrects this. I am running into an issue where one server has sites with unique branding. This is a bummer.

  4. Andrew Woods January 22, 2007 12:35 pm

    I modified the application.master in the _layouts folder and now my _layouts pages are broken, as in there is an ‘unknown error’ when I try to access certain areas such as Site Settings, or Create. I have no idea how to reset the application.master back to its default state in order to get things working again… Any help would be greatly appreciated.

    I know how stupid it was not to backup the file before I did this.

  5. shane January 22, 2007 12:42 pm


    There is a pretty good chance you may be removed a placeholder which another page is trying to use. (or if you edited in SharePoint Designer, it’s likely a change was made to the page tokens)

    Your best options are:

    1) The obvious – learn from this mistake, and never make file-system changes without backing up.
    2) Turn on friendly error messages so that you have a better chance at troubleshooting: http://www.graphicalwonder.com/?p=648
    3) If all else fails, grab a clean (MOSS 2007) application.master, and overwrite your old.

  6. Josh February 5, 2007 9:08 am

    ok the layouts directory from the application.master file was remapped into a personal site created. Now everytime you import a spreadsheet for a custom list, it gives an error “This Virtual Directory does not allow contents to be listed.” Was there a change in the page tokens? Any help would be great

  7. Chris March 5, 2007 1:38 pm

    I have made changes to the class that makes the welcome menus now WHITE instead of BLACK (or gray?) the way they are by default. By doing this, you obviously change them in the admin too. But the admin section uses “Application.master”.. in which if you change that file, very bad things happen, according to the above comments.

    AND, furthermore, you cannot override (as far as I’ve been able to) the inner style class constructed on the fly.

    Take for example the following server control

    This generates the ever so loved Welcome COMPANYNAME\Administrator.

    This wonderful little server control generates its own DIV around itself with the class of class=”ms-SPLink ms-SpLinkButtonInActive”
    And guess what? Modifying either of those modifies it everywhere. Even if you !important previous classes, you simply cannot (that I’ve found) get inside of this thing.

    Can anyone think of a way to do this properly and carefully?

  8. Luke Evans March 8, 2007 9:27 pm


    I am currently customizing a site. I have completed the customization from ‘default.master’ and all the pages pointing to ‘default.master’ for the layout are working fine.

    But if you go to a page like ‘View All Site Content’ (http://mysharepointsite/_layouts/viewlsts.aspx) or ‘Site Settings’, these pages seem to be referencing a different master page for their layout.

    Where can I find this ‘master page’ to fix the layout?? My _layouts folder is not visible in SPD.

    Looks like this could be a touchy/dangerous subject, from reading other post on this thread…

    Any thoughts or direction??


  9. Alex Pearce March 19, 2007 9:36 am

    Josh – did you find how to fix your problem as i have the same as well.



  10. Zach April 2, 2007 1:20 pm

    I found that as long as I modified my application.master within Visual Studio 2005, everything worked okay. But, if I used SharePoint Designer 2007, it hosed the site.

  11. Jason May 16, 2007 10:19 am

    Ok, so I’m an idiot and modified this file (in SPD) BEFORE reading all these lovely warnings online that I shouldn’t. Of course now I’m getting errors. The log contains:

    Exception Type: System.Web.HttpException Exception Message: The file ‘/_layouts/_controltemplates/TopNavBar.ascx’ does not exist.

    This file does exist in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS

    I restored the file contents from the backup I made before monkeying with it (just a Notepad copy/paste) but it looks like my tokens are messed up now in WSS. Any suggestions on how I can check/repair them?

  12. Michael Brown June 20, 2007 12:29 pm

    Hi, I ran into this same problem. SharePoint Designer changes the src on the registered controls for the page by removing ~/. This was an issue I ran into with application.master.

    It changes to:

    It should be what is below, notice SharePoint Designer removed the ~/ on the src attribute above:

  13. Magnus August 13, 2007 5:40 am

    I seem to have opened the application.master and the createpage.aspx in SPD.

    i now try to access the createpage.aspx page and get:

    The file ‘/_layouts/_layouts/application.master’ does not exist. at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath)
    at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
    at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
    at System.Web.UI.BaseTemplateParser.GetReferencedType(VirtualPath virtualPath, Boolean allowNoCompile)
    at System.Web.UI.PageParser.ProcessMainDirectiveAttribute(String deviceName, String name, String value, IDictionary parseData)
    at System.Web.UI.TemplateParser.ProcessMainDirective(IDictionary mainDirective)

    can anyone help out?

  14. Magnus August 13, 2007 5:52 am

    I add the ~ in the createpage.aspx file since it was missing, but then I get:

    The server tag is not well formed. at System.Web.UI.TemplateParser.ProcessError(String message)
    at System.Web.UI.TemplateParser.DetectSpecialServerTagError(String text, Int32 textPos)
    at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
    at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)

  15. Magnus August 13, 2007 6:11 am

    OK. so i just replaced the Createpage.aspx with an old one.

    Now it works again. Damn the Sharepoint Designer!

  16. shane perran August 13, 2007 6:21 am

    Opening your application.master in SPD changes some code at the top of the page. You can either add the ~/ back to your registered controls or you can grab a fresh application.master – from a different install.


  17. Magnus August 13, 2007 6:28 am

    Ok, thanks.

    I am trying to narrow down the page layout options for the user on the CreatePage.aspx page. So I was thinking I should edit this page.

    Then, even the slightest modification in this CreatePage.aspx file (just adding a simple linebreak wherever) gives me this error:

    The server tag is not well formed. at System.Web.UI.TemplateParser.ProcessError(String message)
    at System.Web.UI.TemplateParser.DetectSpecialServerTagError(String text, Int32 textPos)
    at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
    at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)

    Why?? Because I am using Wordpad instead of SPD?

  18. Scott September 13, 2007 1:53 pm

    So, this is fun. I too opened the application.master page before reading that opening it in SPD would send the globe sprialing out of orbit.

    I thought, no big deal I’ll replace it with the backup I have. Replacing the backup DID NOT WORK, and I KNOW that it was a clean backup because I didnt touch it! :P So after reading here I went and got a “clean” copy of the file and replaced it with that. Now, when trying to view, for example, the /_layouts/viewlsts.aspx page I get a HTTP 403 Forbidden error.

    I looked into the permissions, and I mean, obviously no permissions changed but its telling me that somehow, some way, they did. I’m really very stuck at what even to check next.

    Anyone have any advice on what else I can look in to to solve this mess?

    Also, thanks for writing up the warning so other people can find it, its greatly appriciated. It helps a lot to be able to find this kind of information. =)


  19. Paul October 27, 2007 6:06 am

    I used the information at this site, Andrew Connell and Heathers too, and I’ve written 5 articles and I’m currently working on part 6 of an epic SharePoint branding series. The deeper I dig the more articles it requires. Anyway, I went through 6 non nasty methods of dealing with this application.master and core.css.


    Hope its of help to some..

  20. Brian Carnes October 31, 2007 2:00 pm

    Microsoft posted an article on this subject yesterday. How to customize application pages in the Layouts folder in SharePoint Server 2007 and in Windows SharePoint Services 3.0: http://support.microsoft.com/kb/944105

  21. yugandhar January 11, 2008 12:54 am


    I am currently customizing a site. I have completed the customization from ‘default.master’ and all the pages pointing to ‘default.master’ for the layout are working fine.

    But if you go to a page in a sub site or top site and open a custom list page, open an item to view or edit the page, it is redirecting to its corresponding pasis having the same master page what i mentioned but the font size is so small that i can’t even read.I didn’t changed any thing in core.css, for any modification for style in master page i created a different style sheet – mystyle.css and i’m using it for background colors. This problem is every where in the site view or edit item page.I’m having 33 subsites in a top level site and all are facing this problem.Can any one of you help me in this.This is an urgent problem.


  22. Stephen Kaye March 11, 2008 10:20 am

    I’ve developed a solution that allows the site admin to specify an alternate to using the application.master per web.


  23. OfficeDeveloper.NET :: Ty Anderson March 11, 2008 6:09 pm

    A Must Have Reference for Building SharePoint 2007 Master Pages…

    If you have been involved in branding a SharePoint 2007 si ……

  24. Rob Monti July 10, 2008 2:52 pm

    Well, I too forged ahead without heeding the warnings, and now I’m paying for it. I backed up the application.master file, but unfortunately I made the mistake of attempting to edit it in SPD.

    I’m positively ill at this point.

    Anybody know where I can get a clean application.master file?

  25. officedeveloper.net » Blog Archive » A Must Have Reference for Building SharePoint 2007 Master Pages August 13, 2008 12:23 am

    [...] January 23rd, 2007 If you have been involved in branding a SharePoint 2007 site with a custom skin, then you know how important it is to understand SharePoint’s underlying CSS structure.   I ran across this post at Heather Solomon’s blog: http://www.heathersolomon.com/content/sp07cssreference.htm   She has a done a great job of explaining each CSS class defined in SharePoint’s core CSS files. What I like best is that she posted screenshots of the GUI elements that affected by each CSS class.   We recently completed a project where, among building some great web parts, we branded a SharePoint site. Not only did we a create master page design for the Content Pages (the pages intended for site visitors to see), we also applied a branded master page to the Application Pages. This isn’t easy as the application pages are any page that reside in a SharePoint sites _Layouts folder. For some reason, the SharePoint team didn’t think these pages would need to be skinned as SharePoint does not support this scenario out of the box.  We found a work around at Graphical Wonder:   http://www.graphicalwonder.com/?p=532   The discussion on Shane Perran’s site of application.master pages is very informative and is a must read for anyone looking to buils a branded site on SharePoint.   [...]

Leave a Reply

You must be logged in to post a comment.