Hide the Sign In link for the anonymous access user in anonymous access enabled site – Bend the Welcome.ascx – SharePoint MOSS

Lots of thing can be done by playing around the Welcome.ascx user control. I have came across one of the interesting thing on hiding the “Sign In” link for anonymous access users in the public facing internet site and thought of sharing with you.


Following are the two steps to implement this requirement in the supported way and its quite easy, thanks to master page and the SharePoint Application Page link control.


1.    Create a custom user control based on the OOB “WelCome.ascx” control. Override the “OnLoad” event and hide the “Sign In” application page link for the anonymous access user.


2.    Create a custom master page based on the any OOB parent master page with respect to your requirement and site definition. Render the Custom welcome control in the place of OOB welcome control.



You can find the Welcome.ascx user control under the “Control Templates” folder. Bunch of menu items are available for the authenticated user like My Settings, Sign in as different user, Log Out and Personalize the page. All these menu items are available as feature menu template and will be available only if the user was authenticated successfully. Following is the structure of the feature menu template and all the menu items are available under the ID “ExplicitLogOut”. You can see that the visibility of this Personal Actions control is false and the visibility will be made to true when the user is successfully authenticated.

 <SharePoint:PersonalActions AccessKey="<%$Resources:wss,personalactions_menu_ak%>" ToolTip="<%$Resources:wss,open_menu%>" runat="server" id="ExplicitLogout" Visible="false">


       <SharePoint:FeatureMenuTemplate runat="server"







             <SharePoint:MenuItemTemplate runat="server" id="ID_PersonalInformation"








             <SharePoint:MenuItemTemplate runat="server" id="ID_LoginAsDifferentUser"







             <SharePoint:MenuItemTemplate runat="server" id="ID_RequestAccess"







             <SharePoint:MenuItemTemplate runat="server" id="ID_Logout"







             <SharePoint:MenuItemTemplate runat="server" id="ID_PersonalizePage"











             <SharePoint:MenuItemTemplate runat="server" id="ID_SwitchView"





             <SharePoint:MenuItemTemplate runat="server" id="MSOMenu_RestoreDefaults"













The another part of the welcome user control is “ExplicitLogin” which has been rendered as the SharePoint Application Page Link as follows.


<SharePoint:ApplicationPageLink runat="server" id="ExplicitLogin"

      ApplicationPageFileName="Authenticate.aspx" AppendCurrentPageUrl=true

      Text="<%$Resources:wss,login_pagetitle%>" style="display:none" Visible="false" />



This is the link which we need to concentrate for this requirement. By default this link visibility is false and will come alive when the user is not authenticated. This is what happens with the anonymous access user. When the anonymous user access the site this link is visible so that the unauthenticated user can sign in.


Fair enough on the post mortem of the welcome user control. Now copy this welcome user control and paste it under the Control templates folder as “CustomWelcome.ascx” control. In the “CustomWelcome.ascx” control add an In Line script and override the “OnLoad” event. In the “OnLoad” event for the unauthenticated user hide the  “ExplicitLogin” link.


protected override void OnLoad(EventArgs e)




        if (HttpContext.Current.User.Identity.IsAuthenticated)


            this.ExplicitLogout.Visible = true;




            this.ExplicitLogin.Visible = false;

            this.ExplicitLogin.Attributes.CssStyle.Add("display", "block");





Now we are done with the custom welcome user control. Let us have a look on rendering it through the custom master page based on the “default.master” master page. Copy the default.master page and add the Tag prefix reference for the “CustomWelcom.ascx” control as follows in the custom master page :


<%@ Register TagPrefix="wssuc" TagName="CustomWelcome" src="~/_controltemplates/CustomWelcome.ascx" %>


Find the following entry in the master page :


<wssuc:Welcome id="IdWelcome" runat="server" EnableViewState="false">



Replace the above entry with the following entry to replace the OOB welcome user control with your custom welcome user control :


<wssuc:CustomWelcome id="IdWelcome" runat="server" EnableViewState="false">



Save the custom master page and use it for the public facing internet site and now “Sign In” link will not be available for the unauthenticated anonymous access user.


If you are aware of the whole welcome.ascx control and its structure then you can play with it for bending its behavior through custom user control. Happy customizing J

Comments (4)

  1. To customize SharePoint “Sign In” link, we need to modify or duplicate Welcome.ascx in your Control Templates

  2. Emma says:

    I did exactly what's on the post attempting to hide the "sign in" link for anonymous user except I changed the closing tag from </wssuc:Welcome> to </wssuc:CustomeWelcome>. And on the override "onload" I put the inline code in <script>, but there's not change at all.

    Would you instruct me as to what was the step that I didn't do right?

    Thank you.


  3. Bandwagon says:

    Best thing to do is:

    1. Duplicate Welcome.ascx and rename it something like customWelcome.ascx

    2. Open it in Notepad or Sharepoint Designer. The file is here: C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14TEMPLATECONTROLTEMPLATES)

    3. In customWelcome.ascx, change the very last line inside SharePoint:ApplicationPageLink (at the very bottom) where it says Text="<gobbledygook>" to Text="<span class='logintext''>Log me in or whatever you want to go here…</span>"

    3. In your master page, replace this….

    <wssuc:Welcome id="Welcome" class="rounded" runat="server" EnableViewState="False" Visible="True"></wssuc:Welcome>

    …with this….

    <wssuc:customWelcome id="customWelcome" class="rounded" runat="server" EnableViewState="False" Visible="True"></wssuc:customWelcome>

    4. Also in your master page beneath this…

    <%@ Register TagPrefix="wssuc" TagName="Welcome" src="~/_controltemplates/Welcome.ascx" %>

    …add this…

    <%@ Register TagPrefix="wssuc" TagName="customWelcome" src="~/_controltemplates/customWelcome.ascx" %>

    5. Check in major, approve, then check.

  4. salil says:

    how can we replace welcome control from custom welcome control on page load?

Skip to main content