I wanted to have a code behind file for home.aspx file for my sharepoint site. but on adding this

<%@ Page 
    Inherits="MyNamspace.MyCustomCodeBehindForHomeAspx, $SharePoint.Project.AssemblyFullName$"

It is throwing this error : The dynamicmasterpagefile attribute on the page directive is not allowed in this page.

I want to know why it is throwing this error


Check that your code-behind MyNamspace.MyCustomCodeBehindForHomeAspx class inherits one of the SharePoint page classes: UnsecuredLayoutsPageBase or its descendant. This property is declared in it.

Another option is if you'r trying to use your aspx-page as Site Page instead of _layouts-page.

Take a look at MSDN for more details about DynamicMasterPageFile token.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.