Wondering mind

The thoughts of a Microsoft Premier Field Engineer on anything and everything SharePoint.

How to know what WFE your connected to….with a Load Balancer

How to know what WFE your connected to….with a Load Balancer

  • Comments 1
  • Likes

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.

 

The issue:

 

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

 

My Answer:

 

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">

<html>

<p>Server name is <%= HttpUtility.HtmlEncode( Request.ServerVariables["SERVER_NAME"] ) %></p>

<p>Logged on user is <%= HttpUtility.HtmlEncode( Request.ServerVariables["LOGON_USER"] ) %></p>

</html>

 

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.

 

Comments
  • Thanks for Sharing useful information

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment