Nick Grattan's Blog

About Microsoft SharePoint, .NET, Natural Language Processing and Machine Learning

Logging in as a different user

with 7 comments

When using default.master in SharePoint users have the “Sign in as Different User” menu option on the “Welcome” menu to login as a different user. This is useful when testing security etc.

This menu is often removed when customizing sites – clients we find often do not want these options displayed. So how can you add a link to allow this facility for testing?

The “Sign in as Different User” navigates to the /_layouts/AccessDenied.aspx page, which displays thus:

Accessdenied

You’ll notice the link “Sign in as a different user”. From the browser status bar you can find the target of this link:

Accessdenied2

So, it turns out to login as another user you simply need to navigate to:

/_layouts/AccessDenied.aspx?loginasanotheruser=true

The standard browser username/password dialog box will be displayed without the “Access Denied” page being displayed to the user.

 

 

 

Written by Nick Grattan

December 3, 2008 at 1:11 pm

Posted in SharePoint Power User

Tagged with ,

7 Responses

Subscribe to comments with RSS.

  1. Excellent! Very helpful tip.

    Robin

    March 5, 2009 at 9:45 pm

  2. Thank you very much for your help

    Pr0fess0rX

    December 24, 2009 at 12:35 pm

  3. Great post, but I find that either using this method or even doing it through the SharePoint Web Services interface that many times the user change does not actually commit unless you refresh the browser several times. Has anyone seen this before? How did you work around it. I have duplicated in IE and FF. Have searched online and not found a solution as yet.

    Thanks,

    Paul

    Paul

    July 8, 2011 at 11:25 pm

    • Paul, I’ve not seen this behavior. Also, I’m not sure what you mean by “doing it through the SharePoint Web Services” interface. I have, though, seen issues when the user you login as does not have permissions on the current page. Regards, Nick.

      Nick Grattan

      July 9, 2011 at 8:58 am

      • Sorry – I just meant selecting it from the Welcome (Name) Menu (in addition to the way that you have mentioned here).

        I did a little more digging last night and found some more info about this issue:

        http://support.microsoft.com/kb/970814/en-us

        I think that this is my issue because I do have some custom web parts that are configured to display data based on the logged in user. I’ll follow back up and let you know if this resolves it for me.

        Thanks, Paul

        Paul

        July 9, 2011 at 2:05 pm

  4. Hi,

    Any solution on this?

    I have the same issue now. If you could share it that would be great and very much appreciated!

    Ad

    Ad

    October 4, 2012 at 5:09 pm

    • I have experienced issues completing this process, however, I have noted that you must close down all web browsers before going directly to the URL Nick has supplied, otherwise it caches you straight away.

      Paul

      November 21, 2012 at 10:58 pm


Leave a reply to Nick Grattan Cancel reply