Hiding the Ribbon for Anonymous Users
Posted
Friday, April 23, 2010 2:57 PM
by
Itay Shakury
If you are designing a public facing internet site based on SharePoint 2010, you probably don’t want the ribbon in your design. Still, the ribbon provides the basic tools that your authors use, so you probably need a way to show it only to them.
I have tried so search for opinions and implementations for this on the web, and found several different approaches to complete this task.
Client side:
Pros: It’s easy to integrate into your site. Toggling visibility of the ribbon is super fast.
Cons: The entire control hierarchy is still loaded to the page, so it makes loading a bit slower.
Here is a video that shows you how you can check for anonymity, and hide the ribbon using java script:
http://www.youtube.com/watch?v=k5vg4DYUJNI
Server Side:
Pros: You have more control over what happens and when. Say, if you wanted to hide the ribbon based on a custom logic. Also, the Ribbon doesn’t render at all – faster loading times.
Cons: Harder to implement. Switching the ribbon on and off (if possible) is slow. Harder to implement. Requires admin and server access.
Here is a post that shows how to hide the ribbon by using SPSecurityTrimmedControl, which is a standard SharePoint control that gives control over content that needs to be security trimmed:
http://www.thesug.org/Blogs/kyles/Lists/Posts/ViewPost.aspx?ID=34&RootFolder=/Blogs/kyles/Lists/Posts
Another approach is to use LoginView, which is a standard ASP.net control:
http://vspug.com/benrobb/2008/06/20/howto-display-parts-of-a-page-to-anonymous-users-only/
Another server side approach, which to I haven't found references, might be to place the ribbon inside a EditModePanel control. In this approach, the ribbon will be shown only when the page is in edit mode. This approach is relevant only to publishing pages.
Login Control:
Regardless of the approach you choose, you should remember that the “Login” control is actually placed inside the ribbon, and so if we hide the ribbon, users won’t be able to log in.
The solution is easy, take the login control (it’s name is “wssuc:Welcome”) and move it from the ribbon to somewhere else on the page.