Friday, April 19, 2013

Sign in as a different user option gone in SharePoint 2013

When you open a site in SharePoint 2013, you will notice that the option to sign in as a different user has disappeared. As a SharePoint administrator this option was a very helpful tool so hopefully Microsoft will decide to add it back in one of the next Service Packs or cumulative update packages.
What happens now when you open a site being logged in with a “normal” Windows user account is that you will see the below message.

Sorry, this site hasn't been shared with you.

In SharePoint 2013 this message means that you do not have access to the site so you would love the option being there to be able to login as a different user but unfortunately, it’s not there.
What to do now?
Launch your web browser as another user:
  1. Create a shortcut of your browser on to your desktop. If using Internet Explorer, navigate to C:\Program Files (x86)\Internet Explorer and drag iexplore.exe to your desktop to create a shortcut
  2. Right click on your shortcut and rename it to something useful such as SharePoint login. SharePoint login would be the user name (probably admin account) you want to test your applications with or log into SharePoint as.
  3. Right click on your shortcut and select properties and change the shortcut target to:
    • %systemroot%\System32\runas.exe /user:user@domain “%ProgramFiles(x86)%\Internet Explorer\iexplore.exe”
    • Of course change user@domain to the user you want to log into SharePoint as.
  4. Click OK to save
  5. Double click the shortcut, you’ll get a prompt. Type in your password (you won’t see anything as you type, so be careful as you type) and click Enter
  6. You may be prompted to authenticate to the site once more.

Add the menu item back to SharePoint
1. Navigate to the Welcome.ascx file and open it in a text editor
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES
2. Add the following snippet before this line <SharePoint:MenuItemTemplate runat=”server” id=”ID_RequestAccess”
<SharePoint:MenuItemTemplate runat=”server” ID=”ID_LoginAsDifferentUser”

3. Save the file
4. Close all opened SharePoint browser sessions
5. You will notice the next time you launch the site, SharePoint gives you the Working on it message and it may take up to a minute for the page to load.
6. Test by logging in as another user.

Use another URL to access the site:
Access the SharePoint site by using the the URL as http://siteurl/_layouts/closeConnection.aspx?loginasanotheruser=true

This option uses an unsupported browser feature which is unreliable and causes other issues. Currently this option does not work in IE 10 and Safari

Thanks to: