2

We are creating an application page and do not want it to inherit the masterpage. Is this possible?

3 Answers 3

1

Remove master page reference from your site

1
  • What do you mean "Remove master page reference from your site first". Do you mean by going to Site Settings -->Site Master Page Settings? there you can choose different master pages. you cannot remove it.
    – Medes
    Commented Nov 8, 2016 at 14:01
3

You should have a line similar like this in your .aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CreateCollabWeb.aspx.cs" Inherits="Something.Layouts.CreateCollabWeb" DynamicMasterPageFile="~masterurl/default.master" %>

Here you can point to a different master page:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CreateCollabWeb.aspx.cs" Inherits="Something.Layouts.CreateCollabWeb" DynamicMasterPageFile="~masterurl/myCustomMaster.master" %
4
  • 1
    OK, what if I want it to be an empty page with white background and text. No masterpage at all.
    – variable
    Commented Mar 24, 2014 at 12:26
  • 1
    Then you would have to have a "blank" masterpage. You can also call your page with ?isDlg=1 to get rid of leftnav and parts of the header Commented Mar 24, 2014 at 12:27
  • Is there any option, this is for purpose of creating a terms and conditions page. Any other idea?
    – variable
    Commented Mar 25, 2014 at 14:00
  • Those are your options Commented Mar 25, 2014 at 14:32
2

Remember that Application pages are just normal .aspx pages, nothing SharePoint specific.

So you can just remove the DynamicMasterPageFile property from the <%@ Page %> tag.

Just remember to add html, head, body now that a masterpage is no longer dictating the html structure.

5
  • But I want to use the sharepoint object model in the code behind.
    – variable
    Commented Mar 25, 2014 at 5:31
  • page gives error
    – variable
    Commented Mar 25, 2014 at 6:06
  • I tried this but there is technical error when loading page
    – variable
    Commented Mar 26, 2014 at 6:58
  • @variable What does the ULS log say?
    – user2536
    Commented Mar 26, 2014 at 8:08
  • I guess it needed somthing with runat=server; <form runat="server"> worked
    – variable
    Commented Mar 26, 2014 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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