SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is a repeat of a similar question which was never answered so I wanted to give it a fresh start. In fact it looks like some SPDoctor closed it with very odd comments.

Anyway; I have a web part that does nothing other than retrieves the current user and formats a nice welcome message.

 string currentWeb = "", fullName = "";

            fullName = SPContext.Current.Web.CurrentUser.Name.ToString();
            currentWeb = SPContext.Current.Web.Title.ToString();
            fullName = "Guest";
            currentWeb = "St. Joseph";

        ltfullName.Text = "<h2>" + fullName + ",</h2>";
        ltsiteName.Text = "<h3>" + currentWeb + "</h3>";

I too am having intermittent users report that it is not their name but some other user.

We are thinking that either this is some type of Netscaler / load balancer setting causing this or some type of bug in the MS API?

share|improve this question
How is it netscaler set up? Does it impersonate? Is it just doing straight through proxy? – Roman Apr 2 '12 at 23:19
Try adding a timestamp to your output, so you can get a feeling for if it's caching or impersonation that causes the problem. If the timestamp is old then it's probably caching. – Per Jakobsen Apr 3 '12 at 10:49
up vote 1 down vote accepted

This has happened to me when I used caching. I wrongly configured the output cache causing SharePoint to return pages already rendered by other users. Therefore showing the name on the webpart of another user. So maybe check on that.

Another one could be to check your loadbalancer to have sticky sessions (affinity) configured. If it has affinity on users should always land on the same Web Front End.

share|improve this answer
This solution looks promising. I'll try this and report back. If this does work we will have to figure out some code that compensates when the output cache is on. – ChiliYago Apr 3 '12 at 16:28
so far this seems to be working for us. I wondering how to code for this so the output cache does not affect it. – ChiliYago Apr 4 '12 at 12:48
I think you could use the Client Object Model and for example retrieve the current web and user using Javascript. I have not tried this in a situation as you described, so it will need to be tested. – Roel Hans Bethlehem Apr 9 '12 at 6:28

Does it starts giving wront output from the first request itself, or it starts failing in subsequent requests?

Do you have other web parts on the page that might be conflicting with this web part.

I have never had any issues using this method call, do you think you have impersonation enabled in some other part of the code?

share|improve this answer

I've came across something similar, quite a few years ago though. The solution was disabling automatic login in IE (under the security zone --> custom level --> prompt for username and password as the bottom). Access the site, it will ask for username and password, enter your own and make sure the correct user is displayed. Then set the security zone properties back to what it was. Some kind of weird identity caching in IE.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.