The base type [type] is not allowed for this page. The type is not registered as safe.

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?

lee-corso

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:

  1. Get the URL of the master page
    1. Go to Site Actions>Site Settings>Galleries>Master pages and page layouts
    2. Click the dropdown arrow in the Name column of the master page you modified and select View Properties
    3. Click the master page name and copy the URL from the address browser bar
  2. Go to Site Settings>Site Actions>Reset to site definition
  3. 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.