Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question

3 Answers 3

up vote 1 down vote accepted

Remove master page reference from your site first, than place this sample code to try it out

<html>

    <head>


    </head>

    <body>
        <form runat="server">
    this the the policy page
    <br /><br />
<input onclick="close_window()" type="button" value="Close" />
    <asp:Button ID="Button1" runat="server" Text="Accept & Continue" OnClick="btnContinue_Click" />



        </form>

    </body>
</html>
share|improve this answer

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" %
share|improve this answer
    
OK, what if I want it to be an empty page with white background and text. No masterpage at all. –  variable Mar 24 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 –  Robert Lindgren Mar 24 at 12:27
    
Is there any option, this is for purpose of creating a terms and conditions page. Any other idea? –  variable Mar 25 at 14:00
    
Those are your options –  Robert Lindgren Mar 25 at 14:32

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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