Problem in MasterPage directives...

Hi!

When I insert a MasterPage directives in my sharepoint custom page I receive the below error.
Any help?

Regards,

Joseph

The referenced file '/12/Template/Layouts/ApplicantManagement.Web/MasterPages/default.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)

Open in new window

LVL 8
PagodNaUtakAsked:
Who is Participating?
 
puru1981Commented:
you need to do this like below:

protected override void OnPreInit(EventArgs e)
{
    base.OnPreInit(e);

    SPWeb Web = SPContext.Current.Web;
    string strUrl =
        Web.ServerRelativeUrl + "/_catalogs/masterpage/default.master";

    this.MasterPageFile = strUrl;
}


http://msdn.microsoft.com/en-us/library/cc297200.aspx
0
 
puru1981Commented:
can you post your ASPX for the page
0
 
PagodNaUtakAuthor Commented:
Hi, Attached here is the ASPX File...
Default111.zip
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
puru1981Commented:
is this path exist in your folder structure
/12/Template/Layouts
0
 
PagodNaUtakAuthor Commented:
yes...
 
0
 
PagodNaUtakAuthor Commented:
Yes, it exist in the folder structure, and in fact I just browse it...
0
 
puru1981Commented:
try to remove the ~ sign from the masterpage path
0
 
PagodNaUtakAuthor Commented:
I been debugging the whole day, yet you found the answer rigth away... thanks...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.