Bagikan melalui


Hiding the SharePoint Login (or anything else)

This is one of those extremely useful little tidbits that doesn't seem to be all that well documented...

If, for instance, on a internet facing site, you want to hide the login control etc at the top of the page, just wrap the sharepoint Login div with the SPSecurityTrimmedControl tag:

    <Sharepoint:SPSecurityTrimmedControl runat="Server" PermissionsString="AddAndCustomizePages">

        <div class="sharepointLogin">

            ...global links table containing the login control etc.

        </div>

    </Sharepoint:SPSecurityTrimmedControl>

 You can use the SPSecurityTrimmedControl to hide other content as well - any content that you don't want to display to users who don't have a specific right. The PermissionsString specifies a specific right - AddAndCustomizePages is only one possibility. All of the possible settings can be found here:

 https://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.spsecuritytrimmedcontrol.permissionsstring.aspx