Skip to content

Master Page gone bad! The base type is not allowed for this page.

February 3, 2018

Recently, I had a user check out a master page, make a change, then upload it to the master page gallery. He did not publish the new master page, so I  thought that even if he had messed it up, nothing could break. I was wrong. What I didn’t realize was that this master page was maintained through a wsp. Any changes to it had to be rolled into a wsp update and deployed that way. I was unaware that this particular site collection was managed that way.

So now, when going to any page on that site, we got a big fat “Sorry, something went wrong” error message. This was followed by a message like this:

The base type ‘MySiteName.MasterPage.MySiteName_Master’ is not allowed for this page. The type MySiteName.MasterPage.MySiteName_Master, MySiteName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c9257e7fd2740965 could not be found or it is not registered as safe.

There was a correlation ID along with the message. Taking the correlation ID into the ULS logs, I found a couple relevant messages, but they didn’t say much more than the page did.

Application error when access /Pages/home.aspx, Error=The base type ‘MySiteName.MasterPage.MySiteName_Master’ is not allowed for this page. The type MySiteName.MasterPage.MySiteName_Master, MySiteName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c9257e7fd2740965 could not be found or it is not registered as safe.
at Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter.AllowBaseType(Type baseType)
at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)
at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)
Microsoft.SharePoint.ApplicationRuntime.SafeControls+UnsafeControlException: The base type ‘MySiteName.MasterPage.MySiteName_Master’ is not allowed for this page. The type MySiteName.MasterPage.MySiteName_Master, MySiteName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c9257e7fd2740965 could not be found or it is not registered as safe.
at Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter.AllowBaseType(Type baseType)
at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)
at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)

I googled around and found a couple blog and forum posts and that helped me zero in on the issue.

This problem can occur when your master page is part of a wsp. When you deploy the wsp, then activate the master page on various SharePoint sites, the master page is “ghosted.” This means that when the wsp is updated, any instances of the master page from the wsp that has been deployed will be updated automatically as well. That’s a great feature if you want to exclusively control the master page through controlled code updates.

But if someone goes in and manually edits the master page in the master page gallery – either through SharePoint Designer or by checking it out, changing it, and uploading it back to the gallery – it breaks this kind of inheritance. It “unghosts” it. And now, anywhere that edited master page is used is now broken. That’s not such a great feature.

But there is a fix. A way to “re-ghost,” or, more officially, reset page to site definition version. Even with your site giving you the big error with correlation ID, other pages that don’t use the master page should still work, including site settings. You can get to it by going to http://mysitename.com/_layouts/15/settings.aspx . That’s for SharePoint 2013. For 2010 it’s http://mysitename.com/_layouts/settings.aspx, for 2016 it’s http://mysitename.com/_layouts/16/settings.aspx .

So go to the site settings.

Under Site Actions, go to Reset to site definition.

By default, the “Reset specific page to site definition version” radio button is checked.

reset_page

In the box for “Local URL for the page,” enter the URL of the master page.

That URL should be something like:

https://MySiteName.org/_catalogs/masterpage/MySiteName.master

If you are not sure of the URL, you can find it in the Master Page gallery. You should be able to navigate to the gallery by appending this to the URL: /_layouts/15/ChangeSiteMasterPage.aspx (or removing the /15 or replacing it with /16 depending on the version of SharePoint you are working with).

Find the Master Page you need to re-ghost, and from that list item’s drop-down menu, select “View Properties.”

In the Properties, there is a hyperlinked name field. Right click on the link and select “Copy Shortcut”. That will give you the URL of the Master Page.

Re-ghosting the master page will eliminate any changes you’ve made since the manual changes to the master page. You will have to re-implement anything you’ve done since then. But if you normally only update the master page through a wsp deployment, and the accidental manual edit of the master page immediately caused this problem, there should be no changes to roll back.

I found these two links to be supremely helpful in my troubleshooting:

http://anoojnair.com/2017/06/master-page-issue-the-base-type-is-not-allowed-for-this-page-the-type-is-not-registered-as-safe/

http://www.blendmaster.net/blog/2012/07/revert-customized-maste-pages-back-to-ghosted-state-in-sharepoint-2010/

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: