Display the server name
If you have multiple StoreFront servers behind a load balancer, it can be useful for support purposes to display the server name you are connected to. StoreFront doesn't provide an API for doing this but you can add a file that runs on the server to get the server name.
Note this only makes sense to do if you are using sticky load balancing so all requests for a user go to the same server.
In the
customweb folder, add a file ServerName.aspx that contains the following:
<%@ Page Language="C#" %>
<%= System.Net.Dns.GetHostName() %>
This contains C# code that runs when the page is requested to get the computer name.
To display the server name at the bottom of the page, add the following to
script.js:
function displayServerName(callback) {
CTXS.ExtensionAPI.proxyRequest({
url: "customWeb/ServerName.aspx",
success: function(serverName){
$('#customBottom').html('Server name: ' && serverName);
},
error: function(){
//do nothing
}
});
callback();
};
CTXS.Extensions.afterDisplayHomeScreen = displayServerName;
You can add some styling to
style.css:
#customBottom {
text-align:right;
color:gray;
font-size:10px;
padding-top:5px;
padding-right:5px;
}