none
Hiding the ribbon for anonymous users RRS feed

  • Question

  • Hi,

    Does anyone know the preferred method of hiding the ribbon for anonymous users in the master page?

    Thanks in advance - Phil

    Wednesday, April 7, 2010 2:18 PM

Answers

  • Hello Phil,

     

    Use below code in your master page, It will help you surely.

    <asp:LoginView id="LoginView" runat="server">

         <AnonymousTemplate>
         <style type="text/css">
           body #s4-ribbonrow {
            display: none;
           }
          </style>
         </AnonymousTemplate>
          <LoggedInTemplate>
           <style type="text/css">
           body #s4-ribbonrow {
          display:inline;
           }
          </style>

        </LoggedInTemplate>
        </asp:LoginView>


    Thanks & Regards, Satish Srivastava
    Thursday, April 8, 2010 11:20 AM

All replies

  • Hello Phil,

     

    Use below code in your master page, It will help you surely.

    <asp:LoginView id="LoginView" runat="server">

         <AnonymousTemplate>
         <style type="text/css">
           body #s4-ribbonrow {
            display: none;
           }
          </style>
         </AnonymousTemplate>
          <LoggedInTemplate>
           <style type="text/css">
           body #s4-ribbonrow {
          display:inline;
           }
          </style>

        </LoggedInTemplate>
        </asp:LoginView>


    Thanks & Regards, Satish Srivastava
    Thursday, April 8, 2010 11:20 AM
  • Thanks Satish, I'll give it a try
    Friday, April 16, 2010 10:03 PM
  • Hi,

    I had the same problem!
    I've tryed your code and it works, but the log in button disappears as well!

    How can I log in now?

    Thanks in advance,
    Kilik

    Monday, April 19, 2010 2:04 PM
  • This code is very helpful when you have created an Intranet and its extended Internet(Public) site. so whenever a User wants to open the Intranet site, then on that time Authentication will automatically asked and it is the right process. but on the time of Public site there is no need to ask Login from user. so, if again you want to login into Public site, this time you need to open Application pages of the site like layout pages etc.

     

     


    Thanks & Regards, Satish Srivastava
    Tuesday, April 20, 2010 11:27 AM
  • Hi there,

    What about in a scenario in which users can login but should not be able to see the Ribbon unless they are of a certain permission level?

    Thanks

    Wednesday, May 12, 2010 1:22 PM
  • Sure you can do it,

     

    On this scenario the concept will be little bit changed. now you have to place this Ribbon into a User control or in Webpart and then  maintain your scenarioas per your requirement.


    Thanks & Regards, Satish Srivastava
    Wednesday, May 12, 2010 2:01 PM
  • This CSS only solution is OK, but I compiled a better solution using security trimmed controls and the method used in this post.

    http://www.portalsolutions.net/Blog/Lists/Posts/Post.aspx?ID=91


    Chris Poteet MCTS
    Friday, September 24, 2010 3:48 PM
  • Hello Satish,

    I am working on the same scenario and would like to hide sign in link for internet users. I am new to sharepoint. Where can I find these master pages? Can I edit in note pad and save it back?

    Thanks
    Sailaja

    Wednesday, September 29, 2010 7:53 PM
  • Hi Sailajaj,

    You can find master pages at eg. http://yousite/_catalogs/masterpage/nightandday.master  location. For better working on SharePoint you can use SharePoint Desinger (Download it, It is free Tool). Yes you can use any editor for maing chnages in the master pages like notepad, dreamweaver etc.

     


    Thanks & Regards, Satish Srivastava
    Thursday, September 30, 2010 7:08 PM
  • Hi Chris,

    You can do same thing using some Custom coding whatever above urls does. But as per my experience manage Ribbon using Web Config file. Beacuse using my previous replied it is ok that Ribbon will be hide, but every times all HTMLS and images for that Ribbons will be downladed on the systesm. So just manage these things using Webconfig file. Means put this code in Public site before HTMLS of Ribbon

    <% 

     

    System.Configuration.ConfigurationManager.AppSettings["ShowRibbon"] != null && System.Configuration.ConfigurationManager.AppSettings["ShowRibbon"].ToString().ToLower() == "true")

     

    { %>

    Code of Ribbon

    <%} %>

    and put this like Tag in WebConfidg file (AppSetting tag)

    <add key="ShowRibbon" value="false" />

     


    Thanks & Regards, Satish Srivastava

     


    Thanks & Regards, Satish Srivastava
    Thursday, September 30, 2010 7:40 PM
  • Hi,

    I have installed Sharepoint designer and did the above change in master file. Now the signIn link is gone for everyone including site administrator and intranet site. Also the search box got disappeared on the home page(search page). I am using MS searchserver 2010 Express. How do I go back to original settings.

    Thanks,

    Sailaja

    Monday, October 4, 2010 6:19 PM
  • If you are using Thursday, April 08, 2010 11:20 AM solution , it is OK for both type of user for Admin or Public . If you will open Public site, then there will be no Sign In option displayed and when you open Internal site, then system will ask credentials. That time you will see Site Action menu on the page instead of Sign In .

     

    If you want to discard this settings then just remove above JS code from your master page and publish it.


    Thanks & Regards, Satish Srivastava
    Wednesday, October 6, 2010 9:00 AM

  • This caused the colors of the ribbon to go white for me so I fixed it by changing display:inline; to display:block;

    Thursday, March 10, 2011 5:03 PM
  • Hi Satish,

    Is possible to hide it only for read only users without modifying master page or adding securityTrimmed control ? Is there a <ReadOnlyTemplate> same as <AnonymousTemplate>


    Dhaval Raval

    Wednesday, August 5, 2015 8:13 PM