Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

SPSecurityTrimmedControl class

Conditionally renders the contents of the control to the current user only if the current user has permissions defined in the PermissionString.


Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class SPSecurityTrimmedControl : WebControl, 

Allows the conditional display of content depending on the user’s permission. The content can be any HTML code or other controls. One use of the SPSecurityTrimmedControl is to hide the Site Actions menu and the Publishing Console from anonymous users:

<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” />

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2015 Microsoft