Remote Desktop Gateway Web service ignores Bypass RD Gateway server for local addresses

I found an issue with 2008 RD Web Access today for one of our clients that was working from home. Their home connection is on the same internal subnet as used in their office.

When connecting via RD Web access he ended up connected via RDP to one of his home machines. Connecting him manually into the Remote Desktop Gateway using his local RDP client was fine if Bypass RD Gateway server for local addresses was unticked. Checking the config on the server I found that the settings RD Web should push to the clients was correct and should have unticked Bypass RD Gateway server for local addresses. However it seemsĀ Remote Desktop Gateway Web service ignores Bypass RD Gateway server.

On further investigation in IIS I found the page responsible for launching the remote desktop, Desktops.aspx, defined all variables except whether Bypass RD Gateway server for local addresses was checked. Instead this was hard coded in a function called BtnConnect() to always be set at “2” (which is to use the gateway only if a direct connection cannot be made), this was changed to “1” (Always use an RD Gateway Server) and have resolved the issue as below:

from:

function BtnConnect()
{
...
if ((DefaultTSGateway != null) && (DefaultTSGateway.length > 0)) {
RDPstr += "gatewayusagemethod:i:2\n";
RDPstr += "gatewayprofileusagemethod:i:1\n";
}
else {
RDPstr += "gatewayusagemethod:i:2\n";
RDPstr += "gatewayprofileusagemethod:i:0\n";
}
...
}

to:

function BtnConnect()
{
...
if ((DefaultTSGateway != null) && (DefaultTSGateway.length > 0)) {
RDPstr += "gatewayusagemethod:i:1\n";
RDPstr += "gatewayprofileusagemethod:i:1\n";
}
else {
RDPstr += "gatewayusagemethod:i:1\n";
RDPstr += "gatewayprofileusagemethod:i:0\n";
}
...
}

Leave a Reply