I am trying to deploy a "plain" .aspx page (no code-behind) to a library in a SharePoint site using a module (web scoped feature). I don't even really need an .aspx page, all I really need is an HTML page, but I need it to use the site's master page for site navigation, etc.
I've used a technique similar to this answer to make a minimal page that will load the necessary JSOM files and provide me a place to put some plain HTML markup. I'm not using any ASP.NET controls other than the basic placeholders. Here's what my markup looks like:
<%@ Page Language="C#" MasterPageFile="~masterurl/default.master" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=126.96.36.199, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=188.8.131.52, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> <%@ Import Namespace="Microsoft.SharePoint" %> <asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server"> <!-- links to style sheets here --> <meta name="WebPartPageExpansion" content="full" /> <!-- links to scripts here --> <SharePoint:FormDigest runat="server" /> </asp:Content> <asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server"> <!-- plain ol' HTML in here --> </asp:Content> <asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server"> My Page Title Here </asp:Content> <asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" > My Page Title Here </asp:Content>
The problem is that after deploying the page, when you load the page it doesn't pull in the site's master page. Everything else works, scripts get loaded and the page is fully functional, just nothing that comes with the master page is there (site navigation etc.) However, if I upload the page through a browser into the library, then it starts pulling the master page correctly.
I tried removing the
Type="GhostableInLibrary" attribute in the module in hopes that it was a ghosting/unghosting problem, and that by treating the page as unghosted it would somehow fix the issue, but it didn't.
I also tried editing the title property of the file once it was deployed to see if an
Update would cause the same changes that happen when I upload manually, and I tried grabbing the file in a feature receiver and calling
Update directly on the
SPFile object, but neither of those worked either.
This is all through a Sandbox solution, which is why:
- I can't deploy the page as an application page to the 15 hive.
- I can't deploy my HTML to the site as an HTML file, and programmatically (in a feature receiver) create a new wiki page, add a CEWP to the page, and link the CEWP to my HTML file. (I could create the page, but
SPLimitedWebPartManageris not available in Sandbox solutions.)
So, does anyone know what is going on here and how I can get the page to reliably pull in the master page?