Display UserName when user logs in

This is not an easy feat. I have included the link on which I have based customizations below. The author did a splended job with illustrating for RDS 2012/R2

I changed some of the code a little so that the three main Browsers {IE, Chrome, and FF} work correctly in my testlab. Following verbatim, FF did not show the user--whereas Chrome and IE did.

File 1:   C:\Windows\Web\RDWeb\Pages\web.config

In this section, copy and paste this code: <system.web>

(on or about Line 53)

<customErrors mode="Off"/>

<compilation defaultLanguage="c#" debug="true">


    <add assembly="System.DirectoryServices, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>



File 2: C:\Windows\Web\RDWeb\Pages\en-us\Default.aspx

Find </script> and paste this code above the </script> so that it's included in that script section
(on or about Line 442)

** Remember to put your own Domain Controller settings in the LDAP section (highlighted)

private static string GetDisplayName(string strUserName)


  string strLDAPPath = "LDAP://dc=windc1,dc=local";

  string strFilter = string.Empty;


  if(strUserName.Contains("\\")){strUserName = strUserName.Substring(1 + strUserName.IndexOf("\\"));}

  strFilter = "(SAMAccountName=" + strUserName + ")";

  if(strUserName.Contains("@")){strFilter = "(UserPrincipalName=" + strUserName + ")";}


  System.DirectoryServices.DirectoryEntry de = new System.DirectoryServices.DirectoryEntry(strLDAPPath);

  System.DirectoryServices.DirectorySearcher ds = new System.DirectoryServices.DirectorySearcher(de);

  ds.Filter = strFilter;



  System.DirectoryServices.SearchResultCollection results = ds.FindAll();


  return (results != null && results.Count > 0) ? results[0].Properties["Name"][0].ToString() : string.Empty;

//return (results != null && results.Count > 0) ? Uri.EscapeDataString(results[0].Properties["Name"][0].ToString()) : string.Empty;



A note about this. I stopped using the Uri.EscapeDataString, as this did not work in FireFox. In FireFox, it would be "blank". Here, I'm just returning the raw text of the AD attribue, Name

Next, you want to add in the following code which is highlighted in that position








File 3:   C:\Windows\Web\RDWeb\Pages\Site.xsl

This is where you actually set it up to display the username.

Find this line

<xsl:variable name="strings" select="document(concat($baseurl,'RDWAStrings.xml'))/str:strings/string"/>

and add the following highlighted line: 

  <xsl:variable name="appfeedcontents" select="/RDWAPage/AppFeed[1]"/>

  <xsl:variable name="strings" select="document(concat($baseurl,'RDWAStrings.xml'))/str:strings/string"/>

  <xsl:variable name="userdisplayname" select="/RDWAPage/@userdisplayname"/>


Find this line

<xsl:value-of select="$strings[@id = 'SignOut']"/>

and add the highlighted line:

<a id='PORTAL_SIGNOUT' href="javascript:onUserDisconnect()" target="_self">

<xsl:value-of select="$strings[@id = 'SignOut']"/>

<xsl:if test="$userdisplayname">  (<xsl:value-of select="$userdisplayname"/>)</xsl:if>



2018-06-23 09_09_47-RD Web Access - Internet Explorer


Adding the current user’s Active Directory displayname to RD Web Access 2012R2

Make Company Text work on Login and Logged-in Page

File 1: C:\Windows\Web\RDWeb\Pages\en-us\login.aspx

Line about 205, comment it out

Add Two "/" and a space to this line. It should look like this:

// L_CompanyName_Text = strWorkspaceName;

Line about 16, change the customizable text to what you want it to say. For example:

string L_CompanyName_Text = "RDS - Lemmermann";

File 2: C:\Windows\Web\RDWeb\Pages\en-us\Default.aspx

Line about 16, change the customizable text to what you want it to say. For example:

string L_CompanyName_Text = "RDS - Lemmermann";

Line about 270, change strWorkspaceName to L_CompanyName_Text


Put the Web Server you're on in the Title Bar

File 1: C:\Windows\Web\RDWeb\Pages\en-us\login.aspx

Line about 17, add customizable text

string L_ServerName = System.Environment.MachineName;

Line about 277, add text for "servername" as such:








File 2:   C:\Windows\Web\RDWeb\Pages\Site.xsl

Line about 25, update by adding in the highlighted code

<title ID="PAGE_TITLE"><xsl:value-of select="$strings[@id = 'PageTitle']"/><xsl:if test="$servername">  (<xsl:value-of select="$servername"/>)</xsl:if></title>

File 3: C:\Windows\Web\RDWeb\Pages\en-us\Default.aspx

You can do the same modification in this file. File 2 will work for both File 1 and 3

Removing the domain requirement for login

Instructions here

Based solely and without permission from: Arjan Mensch

Keep in mind that this worked splendidly also in RDS 2016

Show Remote Desktop/Terminal Server Collection *with* RemoteApps

So, when you add RemoteApps, the Session Collection disappears. With this registry key updated, you can see all of your RemoteApps along with your Session Collection--which can also be renamed

(Do this on the Gateway server where you have the collections defined)

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\CentralPublishedResources\PublishedFarms\<collection>\RemoteDesktops\<collection>  


Results with:


Remove "Connect to a Remote PC" option


Change this to false

<!-- ShowDesktops: Displays or hides the Remote Desktops tab. Value must be "true" or "false" -->

    <add key="ShowDesktops" value="false" />


Update Help Link to either a local file or URL


For each page that has a help link (ie login.aspx), you must edit this code

You can see the LocalHelp has ./rap-help.htm

If you do not use LocalHelp, you can just modify the link in sHelpSourceServer


Hiding the Help link


Go to line 152:

Change this line to look like this:

And change line 154 to look like this:


Forcing the security setting to Public

We need to fix two thing to be able to force users to the public setting without means to change


Open “login.aspx”.

Change lines (approx) 523, 532, 536, 556, 576 and 587 from



   <TR sytle="display:none">

These changes will effectively hide the user interface for changing the security setting.

Save the file.

Open “webscripts-domain.js” and move to line number 14:


Change this line to:


This change will force the code to always configure for public mode.

Save the file.

Refresh or open the Web Access page and you’ll see the interface options for choosing a

security mode is gone.

If you want to hide the grey dividers as well you’ll need to open “login.aspx” again.

Change lines (approx) 513, 516, 519, 597, 609 and 612 from



   <TR sytle="display:none">

These changes will effectively hide grey dividers and moves the Sign in button up.

Save the file.

Customizing the disclaimer

You can replace this text with a text provided by your organization’s legal department, or you can

choose to clear it.

Open “login.aspx” and move to line number 41:

You can clear it (pictured here), or change it to what you want it to say