SPSecurityTrimmedControl Class (Microsoft.SharePoint.WebControls) Home
SPSecurityTrimmedControl Class (Microsoft.SharePoint.WebControls)
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)
Syntax

'Usage

Dim instance As SPSecurityTrimmedControl


'Declaration

<DesignerAttribute(GetType(SPControlDesigner))> _
<ParseChildrenAttribute(False)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class SPSecurityTrimmedControl
    Inherits WebControl
    Implements IDesignerEventAccessor
Remarks

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:

Example

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

System.Object
   System.Web.UI.Control
     System.Web.UI.WebControls.WebControl
      Microsoft.SharePoint.WebControls.SPSecurityTrimmedControl
         Microsoft.SharePoint.WebControls.SPLinkButton
Thread Safety

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

Community Content

SPSecurityTrimmedControl and annonymous access
Added by:Thomas Lee

You can use SPSecurityTrimmedControl to target content to annon users in a FBA site. For more information see: http://blogs.devhorizon.com/reza/?p=508



Reza Alirezaei , MVP
Blog: http://blogs.devhorizon.com/reza

SPSecurityTrimmedControl explained better
Added by:TheTweaker
The below blog posts explain the same better
http://codename-srini.blogspot.com/2009/04/spsecuritytrimmedcontrol-and.html
http://www.crsw.com/mark/Lists/Posts/Post.aspx?ID=38
© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View