MOSS 2007 Master Page File Reference Error – The file or folder name contains characters that are not permitted. Please use a different name.

Just came across this error while creating the custom page layouts in the MOSS 2007 publishing portal. After deploying page layouts, while creating the new pages or updating existing pages based on the custom page layout, came across yellow screen of death error – “The file or folder name contains characters that are not permitted. Please use a different name.”

After looking at the stack trace and custom page layout HTML, I have found out that custom page layout was referencing the custom master page in the page directive as below.

<%@ Page Language=”C#” MasterPageFile=”~masterurl/customIntranet.master” Inherits=”Microsoft.SharePoint.Publishing.PublishingLayoutPage,Microsoft.SharePoint.Publishing,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c” %>

As it turned out, we wanted to use the custom master page for the page layout and reference it from the page directive. It turned out that WSS 3.0 and MOSS 2007 doesn’t allow referencing the custom master page using the masterurl token. According to the WSS 3.0 SDK, Windows SharePoint Services provides several tokens to reference the master page—two dynamic tokens (“~masterurl/default.master” and “~masterurl/custom.master”) and two static tokens (“~site/default.master” and “~sitecollection/default.master”) and you must use one of these tokens in the WSS 3.0 or MOSS 2007 pages.

To resolve the error, we have switched back the custom masterpage reference to the out of box reference – default.master in the page directive.

<%@ Page Language=”C#” MasterPageFile=”~masterurl/default.master” Inherits=”Microsoft.SharePoint.Publishing.PublishingLayoutPage,Microsoft.SharePoint.Publishing,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c” %>

Since default.master reference in the page directive is optional, it is best practice to remove the MasterPageFile property in the page directive.

<%@ Page Language=”C#” Inherits=”Microsoft.SharePoint.Publishing.PublishingLayoutPage,Microsoft.SharePoint.Publishing,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c” %>

To reference the custom master page from the custom Publishing Portal Page layout, please look at this space in near future.

Advertisements
This entry was posted in SP2007 DEV. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

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