How to fix: Error in SharePoint when custom master page is applied
UPDATE: Found this get hit through our support channels several times last week. As it turns out, depending on the missing content placeholder (or other pieces), the cause of the error may be different than just creating new list items; like I previously stated. Therefore, I "genericized" my post to be more applicable to a wider-range of situations. Same steps apply to find what's causing the issue, though.
After changing to a customized master page, creating new items for several lists, along with several other operations, no longer works and result in an error message.
"An unexpected error has occurred."
There may be several causes. One, is that the custom master page is missing necessary content place holders.
Method 1: Identify the missing content place holders by modifying the web.config.
- Browse to c:\inetpub\wwwroot\wss\virtualdirectories\[port of web application]. Note: in this folder you will find a web.config file.
- Open the web.config file in Notepad (or like-application).
- In Notepad, click Edit -> Find, enter "custom" (without quotes). Click Find Next. You should find the following node: <customErrors mode="On" />. Change mode from "On" to "Off".
- In Notepad, click Edit -> Find, enter "callstack" (without quotes). Click Find Next (change direction Up / Down, if needed). You should find the following node: <SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">. Change the CallStack attribute from "false" to "true".
- Save the web.config file, and perform an iisreset /noforce.
- NOTE: After performing the above steps, attempt to reproduce the error in the web browser. The error message should be descriptive in terms of what content place holder is missing. Take note of the place holder name.
- Open the master page, and in code view add: <asp:ContentPlaceHolder id="PlaceHolderName" runat="server" />. Replace PlaceHolderName with that of the actual content place holder name that was shown in the error message from step 5.
Method 2: Find the missing content place holders manually.
- Open SharePoint Designer 2007. Go to File | Open Site and connect to SharePoint site.
- Expand out _catalogs -> masterpage -> open customized master page.
- Go to Code view. Go to Edit | Find.
- In the Find and Replace dialog, enter: "<asp:contentplaceholder" (without quotes). Click Find All.
- Reference the occurrences found in the file with that of available content place holders:
- Iteratively add any missing content place holders to the master page in the form of: <asp:ContentPlaceHolder id="PlaceHolderName" runat="server" />. Replace PlaceHolderName with that of the actual content place holder name.
- Save master page (Check In, and Approve if necessary) after each added content place holder, and test to see if error still occurs.
NOTE: In SharePoint Designer 2007, go to View | Toolbars | Master page to bring up the master page toolbar. This may also help in identifying place holders currently used on the customized master page.
- Modify the default SharePoint content placeholders
- How to: Create a Minimal Master Page
- Minimal or Base Master Pages
I hope this helps some of you SharePoint branders out there running into similar problems. Certainly, there are few things more frustrating then finding out your beautiful and slick-looking master page is actually causing SharePoint to fail. With that said, I am interested in learning what kind of problems you've ran into with customized master page files with SharePoint, and how you resolved the issues.