I'm having some issues finding a good pattern to make some publishing page layouts secured.

The page layouts are built like this

The page layout

<%@ Page Language="C#" AutoEventWireup="true" Inherits="Externwebb.PageLayouts.MyPage, $SharePoint.Project.AssemblyFullName$" MasterPageFile="~masterurl/default.master" %>
<%@ Register TagPrefix="WebControls" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="PortalWebControls" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

Code behind

namespace Externwebb.PageLayouts
    public class MyPage : Microsoft.SharePoint.Publishing.PublishingLayoutPage
        protected void Page_Load(object sender, EventArgs e)
            // ...

Some more info

  • The site is public and have anonymous access enabled
  • Visitors can login to the site using a custom membership provider (Claims)
  • The site uses managed navigation, can I implement session requirement for a certain node and/or all descendants
  • Is there some secure version of the PublishingLayoutPage class


  • Can you explain more about what you mean by secured? Are you talking about content visible to only authenticated users? – Eric Alexander Oct 17 '14 at 3:08
  • @PirateEric That is correct, only to authenticated users – Eric Herlitz Oct 17 '14 at 7:35

In your page layout, you'll want to utilize SPSecurityTrimmedControls. These allow you to build up content regions and place security restrictions on them as to who can see it.

<SharePoint:SPSecurityTrimmedControl ID=”SPSecurityTrimmedControl1″
  PermissionsString=”BrowseDirectories” runat=”server”>
    <PublishingSiteAction:SiteActionMenu runat=”server” />
    <wssuc:Welcome id=”explitLogout” runat=”server” />
    <PublishingWebControls:AuthoringContainer ID=”authoringcontrols”
        <PublishingConsole:Console runat=”server” />

I've used these in a variety of scenarios to show content on the page only for admins and targeting.

| 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.