Hide ribbon from Anonymous users in SharePoint 2013

This SharePoint 2013 tutorial explains, how to hide ribbon from anonymous users in SharePoint 2013 public-facing site using LoginView. The same way we can hide ribbon bar from Anonymous users in SharePoint 2016 public-facing sites also.

Hide ribbon bar from Anonymous users in SharePoint 2013

Suppose we have a SharePoint site, where we want to hide the ribbon row from anonymous users, but the ribbon bar should come for logged in users.

We can use Asp.Net LoginView control to conditionally display content to anonymous users in SharePoint sites.

To use LoginView, open SharePoint 2013 designer and then edit the master page where you want to use this.

The recommendation is to create a new master page, rather than modifying the existing master page in SharePoint.

Then add the below code in the SharePoint master page.

<asp:LoginView runat=”server”>
<AnonymousTemplate>
<style type=”text/css”>
#s4-ribbonrow { display: none; }
</style>
</AnonymousTemplate>
</asp:LoginView>

Here <AnonymousTemplate> means this will be applicable to anonymous users. So let’s say you want something to trigger for logged in users. You can use like below:

<asp:LoginView ID=”lvLogin” runat=”server”>
<LoggedInTemplate>
//This content will appear only to the Logged in users.
</LoggedInTemplate>
</asp:LoginView>

Now in public-facing web sites, the ribbon bar will not appear for the anonymous users rather it will appear for the logged in users in SharePoint.

You may like following SharePoint tutorials:

This SharePoint tutorial, we learned how to hide ribbon bar from Anonymous users in SharePoint 2013/2016 public-facing site using LoginView.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

>