So a few days ago a customer asked me how they can figure out which one of their Web Front Ends there user is currently connected to when they are connecting via a Load Balancer and need to do troubleshooting. And I thought I would write it down here so that everybody can benefit.
A Load Balancer will give us a single point of entry http://sharepoint but masks which server you are actually connected to and if we think the issue is only related to one of those servers how can we tell what machine a user is connected to when we have them on the phone looking at the error message?
NOTE: My answer will only work if you have StickyBits or its equivalent enabled on the load balancer
Create an APSX file and copy it to each front end and name it something cool like MyServer.aspx, you need to copy some code into the file which I mention below.
I would copy the file into the /_layouts/ folder on your SharePoint server so that you can use the file no matter which Web Application your user is in. The folder on the Web Front End by default is:
WSSv3\MOSS2007 – %ProgramFiles%\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Layouts
SPF2010\SPS2010 – %ProgramFIles%Common Files\Microsoft Shared\Web Server Extensions\14\Template\Layouts
NOTE: I do not recommend you edit any ASPX page created by SharePoint as you may discover that we updated it in a Service Pack or Cumulative Update and you then lose your changes (Makes for more work for you getting it back in)
Code for APSX Page:
Copy the following into MyServer.aspx
<%@ Page Language=”C#” %>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>
<p>Server name is <%= HttpUtility.HtmlEncode( Request.ServerVariables[“SERVER_NAME”] ) %></p>
<p>Logged on user is <%= HttpUtility.HtmlEncode( Request.ServerVariables[“LOGON_USER”] ) %></p>
So of course you could change the font, add a header and many other HTML stuff but I’m trying to keep it simple. As well if you want you can gather a bunch of other data using the following line and this link on ServerVariables
<%= HttpUtility.HtmlEncode( Request.ServerVariables[“LOGON_USER”] ) %>
You could get even more difficult using any piece of ASP.NET to do any number of things but again I’m trying to Keep It Simple.
Hope this helps make your troubleshooting that much easier in the future.