How do I set gatewayaccesstoken:s: in c# code?

pw xu 6 Reputation points
2022-09-21T11:02:45.98+00:00

When I set the "RDP. TransportSettings3. GatewayCredsSource = 5;" After. But I can't find the API that sets gatewayAccesstoken: S:. I test MSTSC directly open an RDP file (I can establish a connection). But I couldn't find a valid API to set gatewayAccesstoken.

RDP file contents set as follows:

full address:s:192.168.0.23:3389
gatewayhostname:s:192.168.0.2:443
gatewaycredentialssource:i:5
gatewayusagemethod:i:1
gatewayprofileusagemethod:i:1
gatewayaccesstoken:s:eyJhbGciOiJIUzI1NiJ9.eyJhY2Nlc3NUb2tlbiI6IiIsImNsaWVudElwIjoiMTExLjE2Mi4yNC4zNSIsImV4cCI6MTY2MzU3MDM0MCwiaXNzIjoicmRwZ3ciLCJyZW1vdGVTZXJ2ZXIiOiIxOTIuMTY4LjAuMjM6MzM4OSIsInN1YiI6ImNsb3VkcGNhZG1pbiJ9.V2F7bVjRzlnzYL3M5OG85z9NkRkz_sNGFjjPEk51-G4
networkautodetect:i:0
bandwidthautodetect:i:1
connection type:i:6
username:s:admin
domain:s:
bitmapcachesize:i:32000
smart sizing:i:1
camerastoredirect:s:

audiocapturemode:i:1
drivestoredirect:s:**

Among them:
1)gatewaycredentialssource:i:5
2)gatewayaccesstoken:s:eyJhbGciOiJIUzI1NiJ9.eyJhY2Nlc3NUb2tlbiI6IiIsImNsaWVudElwIjoiMTExLjE2Mi4yNC4zNSIsImV4cCI6MTY2MzU3MDM0MCwiaXNzIjoicmRwZ3ciLCJyZW1vdGVTZXJ2ZXIiOiIxOTIuMTY4LjAuMjM6MzM4OSIsInN1YiI6ImNsb3VkcGNhZG1pbiJ9.V2F7bVjRzlnzYL3M5OG85z9NkRkz_sNGFjjPEk51-G4

I tried to establish a connection using the following method, but nothing worked. The mistakes are still there:
"Disconnect reason :50331709. To use this program or computer, first log in to the following website: 192.168.0.2"

        rdp.TransportSettings2.GatewayHostname = "192.168.0.2";  
        rdp.TransportSettings3.GatewayCredsSource = 5;  
        rdp.TransportSettings3.GatewayProfileUsageMethod = 1;  
        rdp.TransportSettings3.GatewayUsageMethod = 1;  
        rdp.TransportSettings3.GatewayEncryptedAuthCookie = "eyJhbGciOiJIUzI1NiJ9.eyJhY2Nlc3NUb2tlbiI6IiIsImNsaWVudElwIjoiMTAuMTA5LjcwLjIzIiwiZXhwIjoxNjU4ODA1ODgyLCJpc3MiOiJyZHBndyIsInJlbW90ZVNlcnZlciI6IjE5Mi4xNjguMC4xMzI6MzM4OSIsInN1YiI6Inh1cHcifQ.-L-tyRECOy1WyAEGV4VHK0stPdCqOvv7RD6fWouWAFU";  
          
Windows for business | Windows Client for IT Pros | User experience | Remote desktop services and terminal services
0 comments No comments
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.