Recently I needed to make a change to the master page for a SharePoint 2010 publishing site. I opened the master page in SharePoint Designer, made the change, and check the file in. Then I went to the Master Page gallery (Site Actions>Site Settings>Galleries>Master pages and page layouts) and approved the updated master page. Simple, right?
When I returned to the publishing site home page, I got this error message:
The base type CustomBranding.PublishingMasterPageCodeBehind is not allowed for this page. The type is not registered as safe.
It took me a few days and a lot of Google searches, but I finally figured it out. When you modify the master page in the gallery, the page becomes unghosted. Once you re-ghost the page, the error goes away. Here’s how to re-ghost the page:
- Get the URL of the master page
- Go to Site Actions>Site Settings>Galleries>Master pages and page layouts
- Click the dropdown arrow in the Name column of the master page you modified and select View Properties
- Click the master page name and copy the URL from the address browser bar
- Go to Site Settings>Site Actions>Reset to site definition
- Paste the url into the textbox and click “Reset”, then confirm.
Now when you go back to your publishing site, the error should not occur.
