'Sign in as Different User' Not "Taking"

Marc D Anderson
  • 'Sign in as Different User' Not "Taking" Marc D Anderson

    In some instances of WSS or MOSS when you use the "Sign in as Different User" option, the new login doesn't "take". Is there any known issue here? Usually logging out and then logging back in with the second user does work. This seems like a pretty big problem and I've seen it on and off over the years, mostly while testing with different identities.

    UPDATE 1: I'm seeing it in several hosted WSS situations, so I don't actually know what authentication they are using. Interestingly, I don't see it in some hosted WSS situations, too. And consistently within the instance. This might tell us that the authentication method might matter.

    UPDATE 2: Another piece of info I should have included in the first place: The reason that I'm asking this is that the $().SPServices.SPGetCurrentUser in SPServices sometimes returns the previous user. All I'm doing in that function is loading the _layouts/userdisp.aspx?Force=True page and pulling the Name from the page. It's the column with the label 'Account', but the InternalName is 'Name':

    <!--  FieldName="Account"
                 FieldInternalName="Name"
                 FieldType="SPFieldText"
               -->
    

    Here's the SPServices function:

    // Function which returns the account name for the current user in DOMAIN\username format
    $.fn.SPServices.SPGetCurrentUser = function() {
        var username = "";
        $.ajax({
            async: false, // Need this to be synchronous so we're assured of a valid value
            url: $().SPServices.SPGetCurrentSite() + "/_layouts/userdisp.aspx?Force=True", // Force parameter forces redirection to a page that displays the information as stored in the UserInfo table rather than My Site.
            complete: function (xData, Status) {
                $(xData.responseText).find("table.ms-formtable td#SPFieldText").each(function() {
                    if(/FieldInternalName=\"Name\"/.test($(this).html())) username = $(this).text();
                });
            }
        });
        return username.replace(/(^[\s\xA0]+|[\s\xA0]+$)/g, '');
    };
    

    One would like to think that this page would always represent the currently logged in user, but sometimes it represents the prior user. Not good.

    UPDATE 3: I may have come up with a fix for this in my SPServices library, at least. It doesn't solve the larger problem that SharePoint seems to have, though. I added a unique Query String parameter (just the current time) to the call to userdisp.aspx in SPGetCurrentUser per arunduttgp's suggestion. This seems to force the browser to do a hard refresh on the page in the AJAX call, getting the correct values for the logged in user even when the current SharePoint page is showing the prior user incorrectly.

     url: $().SPServices.SPGetCurrentSite() + "/_layouts/userdisp.aspx?Force=True&" + new Date().getTime(),
    

  • I get this a lot, just not consistently. A page refresh will sometimes sort it out. I've taken to just using the "runas" command to avoid using "Sign in as Different User" and the associated issues.

    runas /user:{Domain}\{UserID} [/savecred] "C:\Program Files\Internet Explorer\iexplore.exe [Optional URL]"
    

    You can create shortcuts on your desktop to make this easier.

  • Just refreshing the page is not enough, the majority of times this is simply due to browser caching but a page refresh will not refresh the browser cache.

    In IE you would click Cntrl + F5 to clear the cache and do a full refresh, not sure what the same command would be in FireFox or other browsers but the concept will be the same.

  • I see Paul's comment above about seeing the issue more with NTLM. I run Kerberos in the vast majority of my environments, and I very rarely see it at all, so it could be the case where it's related to NTLM.

    It's got to be some sort of cache either within the browser or the session. I wouldn't think that there's a way to force a refresh through the script, unless you can refresh the destination URL before reading from it.

  • I don't necessarily have a solution for you (other than the "refresh the page a couple times" others have mentioned, but as a data point I only started seeing this behavior when I first upgraded to IE8. In fact on machines where I still have IE7, I never see it at all. I'd be curious if others share this experience.

  • A more dependable way to determine the logged on user may be to just ask the server instead of going through SharePoint ( which at this point is acting as a middle man). Getting the variable directly may help with the whole refresh question as there may be some lag as the credentials are updated, guessing here.

    This page should help. Specifically, the LOGON_USER variable will have the value you need.

Related questions and answers
  • I have a standard website (one Web Application and one Site Collection) with some custom pages and webparts. The issue I'm having is that when I try to switch users, using the "Sign In As a Different User" and entering new credentials (even for another Site Collection admin account), IE tries the account three times, and then it presents a 401 Access Denied screen. After that, if I erase all the stuff of access denied page from the browser's url, I'm logged as the new account I just had entered and was not accepted. After researching for a while on google, I found a KB ( http

  • into it. Either way, it then opens the file in Excel. The code to open the file is some client-side script that figures out the location of the Excel file in SharePoint, sets an href variable to that URL... to them by SharePoint as read-only (so they will get the above error message). However, often they are demonstrably the only user to have accessed the document - in fact, sometimes this will happen... user can open it for editing? Is there any way through the SharePoint UI or APIs to tell who SharePoint thinks has the document open for editing (although in some cases that seems like it is going

  • { $_.GetEnumerator();} However, what I want to do is be able to return a table, or csv file of specific values in the profile, e.g. Username, WorkEmail, WorkPhone. I have tried piping the output to |ft Username, WorkEmail, Workphone and | select Username, WorkEmail, WorkPhone but this just returns blanks. I feel like I am so close. I don't want to replace the $_.GetEnumerator() call with lots of $_.Item("property") calls and it doesn't feel like I should have to. Any ideas?

  • ;/RenderPattern> In WSS 3.0, this would render the 2nd column in the field as a hyperlink in the LVWP, which is what I want. In SharePoint 2010, I tried adding TRUE to my field type definition, but that ends up rendering the actual anchor tag, as opposed to a clickable hyperlink: <a href="http://www.something.com">www.something.com</a> So then I tried creating a XSL transform, since...Has anybody upgraded an old custom field type to use the new XSL transform in SharePoint 2010? I have a multi-column field type, and want the Display pattern to render the 2nd "column", which

  • "publishing portal" for the site collection. I have also enabled anonymous access. Now the basic function is fine, except that I do not know how to change the first front page (i.e. the page showed to end users who have not logged in yet) of the site. Here is a screen snapshot. Any ideas how to edit this page? Publishing home page http://i33.tinypic.com/2hex08j.png BTW: I have tried to edit... on the site collection for the forms authentication logon page to work from Office SharePoint Server. Contact your administrator to have anonymous access enabled in Central Administration and IIS. Manage

  • I'm have some trouble using the GetList web service. It does work sometimes but not at the start of the day!?! Here is my code: public static void ListSurveys(string serverName... because my code had fetched the GUID of the list just milliseconds earlier! Can anyone explain what is going on here? I had the same problem yesterday and at some point it just went away... information using GetList. I use the List GUID as the list name. An exception is thrown. The SOAP body is shown below. <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http

  • Is there any rule that says when SOAPAction is REQUIRED in the setRequestHeader? In my jQuery library (SPServices), I've been including the SOAPAction for every Web Service call. It turns out that is what is preventing anonymous access to the Web Services to work. When I remove SOAPAction entirely and I AM logged in, some calls fail with the following error: errorstring: The security.... operations which write, but I figured I'd toss it out there for ideas. M. UPDATE: @cwheeler76 pointed out this article from Jan Tielens: The security validation for this page is invalid" when

  • , and then as part of that activation, drop web parts onto some specific pages. In my case I want to be able to drop it onto the "AllItems.aspx" page of a list, but I'm equally having trouble adding it to the default.aspx home page. I would be happy either way. Note: I want to be able to activate this on existing site, I dont want to create a new Site Definition. Here is what I have tried: Feature Receiver...), then there doesn't seem to be a way to just get a reference to the page, it always wants to overwrite it with a new file. But I dont want to do that, I just want to add a Web Part to the existing page. See my

  • to be re-crawled in its new content database? We don't want to do a full crawl as the last one we did took more than eight days and in any case we would still have the same problem after the full crawl...In line with Microsoft's recommendation to keep content databases on SharePoint 2007 under 100Gb, we often move site collections to different content databases to balance the load. However, we have noticed a problem - after we move the site collection to a new content database, the entries in the search index for everything in the site collection disappear. This seems strange as the paths