Workaround For Missing "Sign In As A Different User" Custom Action In SharePoint 2016

With the coming of SharePoint 2013, one cool feature that we missed out was “Sign in as different user” that enabled users to open the SharePoint Site under different user credentials. This was a quite handy option for the developers and testers, as they often have to test the application under different privileges. Microsoft has stated various reasons, from inconsistent user behavior to security issues, for taking out this feature. Even in SharePoint 2016 the feature is still dormant. When I say dormant, the feature can still be revived via a couple of options.

System Account

As you can see in the above screenshot, in the SharePoint 2016 ribbon drop down, the menu option to switch user is missing. Let’s explore the options to circumvent this issue.

Option 1 (Simple and Straightforward – End User Friendly)

Press down shift and right click the browser icon. It gives a fly out menu where we can run the browser as a different user. The credential we enter, user for browser validation, will be used to create a security token for the forms digest control within the SharePoint master page, ultimately opening SharePoint Site under a different credential.

Simple and Straightforward

Option 2 (Works with most browsers – Developer Friendly)

Open a new tab and use the following URL to open the SharePoint Site. It basically force closes the existing connection and asks for a fresh set of credentials.

http://siteurl/_layouts/closeConnection.aspx?loginasanotheruser=true

Microsoft has issued the statement that this does not work with IE 10 & Safari browsers.

Option 3 (Quick & Dirty - End User as well as Developer Friendly)

This approach involves modifying the existing Welcome.aspx page. Since it involves modification of a SP Hive file, this is not recommended unless you are doing it in Devor QA servers. For Production this approach is a definite NO as it is against the Best Practice.

This basically involves addition of an extra custom action tag within the Welcome.aspx page. The Welcome.aspx location is as follows:

  • SharePoint 2013:

    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES\welcome.ascx

  • SharePoint 2016:

    C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\TEMPLATE\CONTROLTEMPLATES\welcome.ascx

The major difference between 2013 & 2016 is that they have 15 & 16 Hive respectively.

Once you open up the welcome.aspx page, place the following tag between ID_PersonalInformation&ID_RequestAccess:

  1. <SharePoint:MenuItemTemplaterunat="server" ID="ID_LoginAsDifferentUser"  
  2.    Text="<%$Resources:wss,personalactions_loginasdifferentuser%>"  
  3.    Description="<%$Resources:wss,personalactions_loginasdifferentuserdescription%>"  
  4.    MenuGroupId="100"  
  5.    Sequence="100"  
  6.    UseShortId="true"  
  7. />  
After modification, the welcome page will now look like the following:

After modification

Save the page and now go back to the site. The ribbon drop down will now have the extra Sign in as different user custom action available.

Sign in

This way the option to switch user will be permanently available within the drop down.