Article
0 comment

Hide Content in SharePoint from anonymous users using SPSecurity TrimmedControl

I think SPSecurityTrimmedControl was first introduced in SharePoint 2007. It is widely used to hide certain Elements based on user permission. In SharePoint 2010 a major improvement was introduced. The new property that made available was the AuthenticationRestriction, which gives you better control for anonymous and authenticated users. The possible values that can be specified are:

  • AllUsers – Access is available to all users.
  • AuthenticatedUsersOnly – Access is available only to authenticated users.
  • AnonymousUsersOnly – Access is available only to anonymous users.

If you like to use one of these values you simply need to define your security trimmed control like this:

<SharePoint:SpSecurityTrimmedControl runat=”server” AuthenticationResctriction="AuthenticateUsersOnly">
....
</SharePoint:SpSecurityTrimmedControl>

Now all controls inside the SPSecurityTrimmedControls will be hidden to anonymous users.

AuthenticationRestricion Enum on MSDN

Another great blogs concerning the topics for SharePoint 2010 is Inconvenient SPSecurity TrimmedControl – Waldek Mastykarz . I tried it in SharePoint 2013 and it worked without any problem.

This blog post is a cross post from my blog at sharepoint-community.net

Leave a Reply

Required fields are marked *.


This site uses Akismet to reduce spam. Learn how your comment data is processed.