Thursday, March 6, 2008

master page error : Code blocks are not allowed in this file

problem: When I assigned “application.master” or “layouts.master” pages as master page to my new developed web page, I received this error from share point:
The referenced file '/layouts.master' is not allowed on this page. at System.Web.UI.TemplateParser.ProcessError(String message) at System.Web.UI.BaseTemplateParser.GetReferencedType(VirtualPath virtualPath, Boolean allowNoCompile) at System.Web.UI.PageParser.ProcessMainDirectiveAttribute(String deviceName, String name, String value, IDictionary parseData) at System.Web.UI.TemplateParser.ProcessMainDirective(IDictionary mainDirective)

solution:
try to remove the ~ from the MasterPageFile="~/MasterPage.master" the tag inside the content page and if it still does not work, remove the / if they are "mater page and the content page" in the same root