Step by Step Customizing RD Web Access 2012 R2 – Part 2


In this second post I’ll focus on customizing the main page. That is the page a user sees after the user logs in.

Update: the third post in the series is published, which focuses on customizing the second main page (Connect to a remote PC). Read it here.

Just as a friendly reminder or if you didn’t read the first post (Step by Step Customizing RD Web Access 2012 R2 – Part 1), we’ll be editing the files in the Web Access interface, which can be found in %windir%\web\rdweb\pages\<language-code> on the RD Web Access server.
To be safe, make a full backup copy of the %windir%\web\rdweb\pages folder and subfolders.

The main page is actually made up of two pages. The first page is the page that shows you the published Desktops and RemoteApp programs. By default it looks like this:
RDS Customize Web Access - Default 01
I published several RemoteApps and arranged them into a folder structure.

Customizing the Web Access navigation bar
The navigation bar presents the user with different screens in the main page.
RDS Customize Web Access - Default 02
The navigation bar is defined as two navigation bars actually.
Navigation bar [1] contains the tabs. The “RemoteApp and Desktops” tab is the page we’re on at the moment. The “Connect to a remote PC” tab takes you to the main page’s second page called “Desktops.aspx” and I’ll cover that in the next post.

Navigation bar [2] shows a Help link, and a Sign out link.
The Help link will be covered later.
The Sign out link will sign the user out by calling a JavaScript function called “onUserDisconnect()” and returns to the login page.

Remove the Connect to a remote PC tab from the Web Access navigation bar
In previous versions of RD Web Access you’d have to edit the Web Access files. That’s no longer needed.

On the RD Web Access server open Internet Information Services Manager (IIS Manager).
RDS Customize Web Access - Default 10
Expand the tree on the left and click Pages, then double-click Application Settings and select ShowDesktops. Notice its value is “true” by default and click Edit to change it to “false”. This change is immediate, without the need to restart IIS.

Refresh or open the Web Access page, make sure you’re logged in and check the navigation bar:
RDS Customize Web Access - Default 11
Changing ShowDesktops to false not only removed the Connect to a remote PC tab, but also the divider between the two tabs.
Change ShowDesktops back to true because we’ll need it to be true further down this post.

Adding an extra tab on the Web Access navigation bar
So, we can remove a tab. Can we add another tab? Sure, but it’s not as simple as flipping a switch in the Application Settings.
I am going to add an extra tab called “Custom Tab” which, upon clicking, opens “Custom.aspx”.
The tab definitions are embedded in the Web Access pages, so we need to customize each page that is accessible through the tabs. Luckily we’ll only need to modify two pages at this stage: “Default.aspx” and “Desktops.aspx”.
Open “Default.aspx”.

Insert an extra line before line 18:
RDS Customize Web Access - Default 13
I’ve highlighted the extra line in the screenshot above. Important thing here is not to change anything, make sure you’re adding a line, not overwriting an existing one.
Adding this line tells the code what name to display on the tab.

Move to line 278 and insert another line:
RDS Customize Web Access - Default 14
Again, in the screenshot above I’ve highlighted the line that needs to be added.
This change adds a piece of code that defines the extra tab. You can see the href is “Custom.aspx” and the text this tab will display is defined by L_CustomTab_Text, the line we added in the first change.
Save the file.

To apply these changes to “Desktops.aspx” add the same two changes, but this time insert the first change on line 20 and insert the second change on line 234 and save that file as well. Of course, if you decide to hide the “Connect to a Remote PC” tab you don’t need to apply those changes to “Desktops.aspx”.

As for the “Custom.aspx”, I’ve created a template based on “Desktops.aspx”, stripped of all code that is necessary for that page, and simply added the text “Custom Page Example”. You can download this template here if you wish and build your own custom pages from that. Place your “Custom.aspx” or whatever you named it in %windir%\web\rdweb\pages\<language-code>.

Reload the Web Access interface and make sure you’re logged in:
RDS Customize Web Access - Default 15
How cool is that? We now have a Custom Tab tab on the navigation bar. As a bonus, the default code even adds a divider, we didn’t have to do anything extra to accomplish that.

Clicking it will open the “Custom.aspx” file:
RDS Customize Web Access - Default 16

Customizing the “Help” link
Clicking the link pops up a new window which by default shows the content from http://go.microsoft.com/fwlink/?LinkId=141038.
You can switch this to a local file, which is located on your RD Web Access server.
I showed how to do this in detail in the first post in this series, so I’ll be lazy here and tell you that you need to change the LocalHelp Application Setting on the Pages application in IIS Manager on the RD Web Access server.
After changing this setting the help popup window shows the contents of the rap-help.htm file.
You can customize this file if you want or your can edit the page to point to a different local file or link.

To customize the external link or local help file you need to edit the “Default.aspx” file.
The logic for defining the help pages starts on line 152:
RDS Customize Web Access - Default 03
Change line 153 (“./rap-help.htm”) if you want to use a different local file to show your users, and change line 155 (“http://go.microsoft.com/fwlink/?LinkId=141038&#8221;) if you want to use a different external URL.
Of course, save your changes.
Note: these Help entries are specific to the main page. The login page has a Help link as well and this was addressed in the first post in this series. This means that you could specify different Help content for the login page and the main page if you wish.
Note: if you change the Help entries in the “Default.aspx” file, you may want to make the same changes in the “Desktop.aspx” file to keep them the same in all the main pages, if you’re not hiding the “Connect to a Remote PC” tab.

 

Remove the Help link from the navigation Bar
If you want to hide the Help link on the navigation bar you need to edit %windir%\web\rdweb\pages\site.xsl.

Go to line 311:
RDS Customize Web Access - Default 04
Change this line to look like this:
RDS Customize Web Access - Default 05
Change line 315 to look like this:
RDS Customize Web Access - Default 06
Change line 317 to look like this:
RDS Customize Web Access - Default 07
And change line 319 to look like this:
RDS Customize Web Access - Default 08
The result of these two changes should look like this:
RDS Customize Web Access - Default 09
This piece of code shows line 310 to 320 and reflects the changes that need to be made. These changes turn the code to display the Help link and the divider both into a comment and thus hidden.
Save the file.

Refresh or open the Web Access page and you’ll see the Help link and the divider are gone.
RDS Customize Web Access - Default 28

Adding an extra link to navigation bar
So we just hid the Help link. Can we add our own links here? Yes we can!
Open %windir%\web\rdweb\pages\site.xsl.
Copy this piece of code:

       <td>
             <a href="https://outlook.com" target="_new">
               WebMail
             </a>
       </td>
       <td width="15"> </td>
       <td class="dividerInNavigationBar">|</td>
       <td width="15"> </td>

And insert it just before line 311, the same line we changed first to get rid of the Help link.
The result will look like this:
RDS Customize Web Access - Default 18
That is including the changes we made to hide the Help link.
The new code adds a hyperlink to https://outlook.com, displays “WebMail” on the Navigation bar, and adds a divider.
Save the file.

Refresh the Web Access interface and make sure you’re logged on:
RDS Customize Web Access - Default 19
And there’s our new link! Clicking it will open (in my case) a new tab in my browser to Outlook.com.
This is but a simple example. If you want to have a popup like the Help link has, you need to copy the JavaScript function and be sure to call it from the site.xsl.

Removing the bread crumbs trail
I still have to figure out what the added value of the bread crumbs section is on “Default.aspx”.
RDS Customize Web Access - Default 20
Since the RD Web Access’s folder structure is limited to one level, and doesn’t support subfolders, I see no use for it whatsoever.
Especially if you’re publishing Desktops only, or when you’re not using folders at all. It’s just always there:
RDS Customize Web Access - Default 21
Even if we do click a folder, the crumbs are not turned into hyperlinks and we have to click the “Up” icon to go back:
RDS Customize Web Access - Default 22
What if we could strip the “Current folder: /” static text? We’d have a cleaner main page, and if we do decide to use folders and go into one of those folder it would just show a text label with the name of the folder we’re in. Much cleaner.

Open %windir%\web\rdweb\pages\site.xsl.
If you edited this file along in this post, you’ll need to go to line 537, if not, the original line number is 529.
Anyway, you’ll need to edit the highlighted line:
RDS Customize Web Access - Default 24
This line is responsible for 2 things: It will display the static text “Current folder: ” and it will add the current path, including the leading “/”.
So I modified the code to not display the static text and to strip the leading “/” from the current folder path. I also added some ASCII to keep the spacing intact when we’re on the main page.
Modify the code so it looks like this:
RDS Customize Web Access - Default 25
Note that I’ve turned wordwrap on. All code should actually be on one line. To make this a little easier, here’s the code in plain text so you can copy & paste it:

<div class="tswa_CurrentFolderLabel"><span><xsl:attribute name='id'><xsl:value-of select="$feedidprefix"/>CurrentFolderPath</xsl:attribute><xsl:value-of select="substring-after(appfeed:Publisher[1]/@DisplayFolder, '/')"/> </span></div>

Refresh the Web Access page and make sure you’re logged on:
RDS Customize Web Access - Default 26
Voila, no more useless information.
RDS Customize Web Access - Default 27
And of course, clicking a folder shows just the folder name on the folder’s page.

There’s just one thing left to customize on this page and that is custom icons for the published apps and published desktops, including resizing them. This takes a lot of customizing and I will address this in a separate post.

So far for customizing the main page. Everything that’s customizable without adding new functionality or without touching “Branding” is now explained.

In the next post in the series I will focus on customizing the Connect to a Remote PC page. In the post after that one I will focus on Branding the entire Web Access interface.

Arjan

20+ years experience in Microsoft powered environments. Enjoy automating stuff using scripts, powershell, and even batch files. In my free time (hah! as if there is any) I hunt achievements and gamerscore on anything Xbox Live enabled (Windows Mobile, Windows 8, Windows 10, Xbox 360 and Xbox One). When I'm not doing that I enjoy traveling or riding my Yamaha R1 on the edge ;)

Tagged with: , ,
Posted in Customize, Remote Desktop, Step-by-Step guide
49 comments on “Step by Step Customizing RD Web Access 2012 R2 – Part 2
  1. Eric Polin says:

    excellent article.. i can’t wait for the branding write up.

    thanks.

  2. beamex says:

    Reblogged this on BeameX Place – Ramblings on Microsoft Technology and commented:
    Anothter great article on customizing RD Web Access

  3. Brock says:

    I’ve searched far and wide and cannot find an answer. All our published desktops open in full screen span mode. Anyway to default to non-spanned?

    • Arjan Mensch says:

      Hi Brock.
      In a RDP file, if you open it with notepad, you’ll find the Use Multimon option:
      use multimon:i:0
      Here it has the value 0. I’m assuming 0 means disabled.
      I’ve not tested this, but try the following. If you mean to edit this behavior in Desktops.aspx, add this option in the function BtnConnect. In this function find RDPstr += “autoreconnection enabled:i:1\n”;
      After that line add the following code:
      RDPstr += “use multimon:i:0\n”;
      And test it?

      Arjan

    • Matt says:

      Just tried Arjan’s option below, unfortunately that portion is only on the desktop.aspx config and isn’t relevant to the automatically published collection desktop set through your collection properties in Server Manager. To get it to disable multi mon you have to go through your collection setup and specify under Client settings maximum redirected monitors to 1.

  4. Christer says:

    Hi, I pasted the text you supplied and i still got the same Current folder:/ .

    CurrentFolderPath

    • Arjan Mensch says:

      Hi Christer,
      I can only assume you pasted it in the wrong place, or left the original code?
      If you want you can send me your site.xsl (probably zip it), or share it somewhere, and I can have a look.

  5. kudzai says:

    my default.aspx filke and desktop.aspx files are modified but i still do not see any answer

  6. Steve Wylie says:

    Arjan,
    Again, thanks for this great series. I’ve implemented the Custom Tab change linking it to password.aspx to allow a logged on user to change the password. However, I don’t know how to get the User name field to autofill as it does in the case of an expired password. Can you help?
    Thanks

  7. Steve Wylie says:

    I’ve tried to figure out which parts of the code to copy and what other changes to make, but that’s really beyond my ability.
    Thanks

  8. James Gennero says:

    Trying to use the Custom.aspx file you provided as a template but am getting this error:

    Compiler Error Message: CS0103: The name ‘PageContentsHelper’ does not exist in the current context

    This is all fairly new to me.

    • Arjan Mensch says:

      Hi James,
      If you’re editing the ASP in that file, I cannot help you, it’s a bit out of my scope as well.
      If you are using the custom.aspx without editing it, it shouldn’t give that error.

  9. Isaac Haupt says:

    I am curious if there is a way to direct the user directly into the RemoteApp instead of to the Desktop page. Thanks for your great tutorials, they have been great!

    • Arjan Mensch says:

      Hi Isaac,
      I’m not sure I understand your question?
      You mean that Desktop icons are not shown on the default page?
      Or do you mean that when logging in you get redirected to the Desktops page instead of the default RemoteApps page?

  10. Miha Pecnik says:

    Thank you for the series. Is there perhaps a way to change the icons for individual RemoteApps, folder to a List instead of an icon. We have close to 200 apps and our issue is that some of those have long names. We’re unable to differentiate between them (even if using folders), since the names can’t be fully read.

    • Arjan Mensch says:

      Hi Miha,

      There’s no such option out of the box, but I will put it on my to-do list. Sounds like a nice project to write a guide for :)

      • Miha Pecnik says:

        Thank you Arjan. A follow up question, can I easily change the font, font size? That might be all we need.

      • Arjan Mensch says:

        Hi Miha,

        Yes you can.
        Open tswa.css which is in C:\Windows\Web\RDWeb\Pages\en-US.
        Find the part marked with .tswa_ttext.
        Change the font-size from 11px to whatever suits you.

      • Miha Pecnik says:

        Excellent, just what we needed. Thank you.

  11. ashraf says:

    Hi,

    I am having an issue, when open application in rd web and not able to paste text from my pc to RD Apps. Any idea ?

    Thanks

  12. Ed Wheat says:

    Hello,

    I have a question regarding the custom tabs. How would you publish an application to the custom tab?

  13. Soumen Mukherjee says:

    Hi Arjan,

    This is a great article , i have two part question

    1. On the Default.aspx page where i get the RDP resources icon , is there a way i can tap into the Click event to show some kind of message box ?

    2. Also do you have any info as to from where the RDP file contents are pulled out and can i play around with the contents at run time ?

    Thanks,
    Soumen

    • Arjan Mensch says:

      Hi Soumen,
      1. You need to add the onclick event to the xsl file, not the default.aspx. Find the template for the resource in there.
      2. the RDP file is built when you click it, so you could find that function and use that? I’m not sure in which file it is, I have no resources at hand

  14. Mark J says:

    Hi Great article btw.

    I have a quick qeustion on the Main Page above how do I shrink the size of the screen from the top to the bottom?

    I will only have one session desktop icon and I have a large white windows which I would like to shrink so it doesnt look so out of place

    Thanks

    • Arjan Mensch says:

      Hi Mark,
      That one is pretty easy.
      Open C:\Windows\Web\RDWeb\Pages\en-US\tswa.css
      Line 5 defines the height of the main content. Change this into “height:210px;” for instance, which should look great in a default configuration that has just one app or remote desktop published.

  15. Michel P says:

    Hello, we try to create an extra tab as you show, but to open local apps (Word, Excel, Outlook…). We don’t find secure and elegant way to do that. An idea ? Thanks. Michel

    • Arjan Mensch says:

      Hi Michel,
      Since this is a trust issue between the browser which opens the web access page and the local file system, you’d need to adjust security settings, which is a drag.
      I would look into creating a custom ActiveX component, and make that part of your deployment.
      No easy task, and requires a completely different skillset, but if the ActiveX is installed and trusted, this might work.

  16. Shawn M. says:

    When I log into the RDS Gateway internally I am able to view the “connect to remote PC” link. When I log into the RDS Gateway externally that link is not there. How do I resolve to have it show up externally

  17. Ramunas says:

    When we are inside folder, local help not working. Wrong link: …../RDWeb/Pages/en-US/Default.aspx/rap-help.htm

  18. David Smith says:

    Amazing article. It helped so much in setting up my lab. One question, is it possible to deploy applications to the custom tab after it is created?

  19. LG says:

    This is great information. I know it’s been awhile but I’ve installed RDS on 2012R2, one server is running all the functions, RD Web, RD Gateway, RD Licensing, RD Connection broker. I installed the RSA web agent for IIS and configured RSA to protect all the pages. It works fine but it removed the sign out page on RDWeb. I can’t figure out why RSA removed it, is there something I’m missing?
    -LG

  20. mg says:

    Arjan, I’m hoping you have an idea on this one. I have a RDS configuration in place and working fine, but I would like to limit client IPv4 access to a particular session host and not to another. Without adding extra pieces (additional gateway, another authentication layer to handle it at network layer) can I make this work with ipSecurity tab in web.config? I don’t think I can use NPS policies to address this properly without affecting others. I made some progress with the ipSecurity setting in the web.config but referencing the particular collection folder name is the issue. Thank you.

    • Arjan Mensch says:

      Hi mg,
      I have no experience with this kind of setup you’re describing. Even if the gateway was an option for this, the broker would redirect the client to any session host, without knowing that that client was only meant to be redirected to a specific session host. I think your scenario is only possible when using multiple session collections?

  21. Eric says:

    Good article and easy to follow. Is there a way to put static text or hyperlinks in the white space below the published applications? We have a couple of applications, but we also want to give further context as to when to use which one and where to go for more information (as they will not leverage the Help link). Can that be done in the asp page or not?

    • Arjan Mensch says:

      Hi Eric,
      Yes this is possible…. however..
      – You need to find a way to match you extra text or hyperlink to a published app or desktop. You could do this hardcoded in the aspx files or config files, but I’m not sure if that is the way to go
      – When you have figured that out you need to modify the template code for displaying an app icon in the webaccess interface. This template is defined in the Resource part in the site.xsl file. It starts on line 721 in this file by default. The title which is shown by default for example, is coded on line 743.

  22. I’m using Windows Server 2008 and need to remove icon to access the remote descktop, can you help me?

  23. Justin Peterson says:

    Just wanted to add a quick comment to this. This worked extremely well for me, but I just wanted to make one note about removing the “Current Folder: /” text. Your code to copy/paste onto line 529 is listed as follows:

    CurrentFolderPath

    When I did this, it didn’t work. I had to look at the graphic and had to make one revision. This is what I had to enter:

    CurrentFolderPath %#160;

    • Justin Peterson says:

      Seems as if the text I had copy/pasted did not work. What you need to do on the last section is this:
      > %#160;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog Authors
Donate Button

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 322 other followers

Blog Stats
  • 1,913,769 hits
%d bloggers like this: