Display server name in StoreFront 3

Following up this article at the Citrix forum, I’l explain how to display the Server name in StoreFront 3 in the browser. I’m doing that using a text file as a cache.  The reason for this is because I’m trying to use the  server name in the native receiver as well which works offline only (not yet working ).  

My method is based on the older GetServerData.aspx method that I modified for our needs.

Step 1: Create ‘GetServerData.aspx’ in \custom folder.  It does the following:

  • Gets  IP and server name into variables (I use only server name, format is xxx_xxx)
  • Shortens the server name to the first 2 and the last character
  • If it not exists already it writes it to text file /custom/cache/server-info.txt
  • text file is re-created every 24 hours

I’m sure the code can be better but it works for me. 



<%
// Storefront Server Data
string sData = Request["serverData"]+"";
switch (sData)
{
case "clientIP":
Response.Write(GetClientIP());
break;
case "serverName":
Response.Write(GetServerName1());
break;
case "clientIPandServerName":

Response.Write(GetServerName1() + "-" + GetServerName2());
break;
default:
break;
}

%>
<%@ Import Namespace="System.IO" %>

 

Step 2:  In /custom/script.js add the code below

  • It will add the server name to the login and main page of StoreFront
/* Call ASP script */
$('#customBottom').load('custom/GetServerData.aspx?serverData=clientIPandServerName');

/* Adding Server Name to Login Page */
function setDynamicContent(txtFile, element) {
CTXS.ExtensionAPI.proxyRequest({
url: "custom/cache/"+txtFile,
success: function(txt) {$(element).html(txt);}});
}
setDynamicContent("server-info.txt", '.customAuthFooter');
setDynamicContent("server-info.txt", '#customBottom');

 

Step 3:  Add this to  /custom/style.css

/* Footer */
#customBottom {
text-align: right;

/* This creates a half transparent bar optionally */
/*background-color:White;*/
/*opacity: 0.9;*/

background-position: 100% 100%;
color: #4D4F53;
font-size: 12px;
}
#customBottom a:link { color: #4D4F53; }
#customBottom a:visited { color: #4D4F53; }
#customBottom a:hover { color: #4D4F53; }
#customBottom a:active { color: #4D4F53; }

/* Change visibility of Auth Page mods */
.customAuthHeader,
.customAuthFooter,
.customAuthTop,
.customAuthBottom
{
font-size:14px;
color:white;
text-align: right;
}

 

Do a IIS restart and have a look at the right lower corner.

 

Native Citrix Receiver:  I'm really having a hard time to use the server-info.txt file and display it for receiver as well.  Any proposals are welcome. Please leave a comment.