locked
Is there a way to know if a WPF is running from an RDP session RRS feed

  • Question

  • Dear all

    I have build a WPF application which is kind of monitor dash board application of machine control.
    The quality department need to remotly run the application for visualisazion.

    For that we have setup Terminal Service in order application can be handle from there.

    Then the remote user run and RDP session and the WPF application open remotly without trouble.

    The issue I have is that when the WPF client application is executed from an RDP session, I need o desable some feature from it.

    Is there a way to know from a WPF environement if it is exrcuted from and RDP session or not ?

    thnaks for advise

    reagrds 

    Saturday, March 12, 2016 5:15 PM

Answers

  • You could try to add a reference to System.Windows.Forms.dll (Project->Add Reference->Assemblies->Framework) and check the value of the System.Windows.Forms.SystemInformation.TerminalServerSession property:

    bool isRdp = System.Windows.Forms.SystemInformation.TerminalServerSession;
    if (isRdp) { ... }


    Please refer to the following thread for more information: http://stackoverflow.com/questions/973802/detecting-remote-desktop-connection

    Hope that helps.

    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

    Sunday, March 13, 2016 5:21 PM

All replies

  • Try this link:

    http://stackoverflow.com/questions/159910/determine-if-a-program-is-running-on-a-remote-desktop


    Lloyd Sheen

    Saturday, March 12, 2016 8:08 PM
  • You could try to add a reference to System.Windows.Forms.dll (Project->Add Reference->Assemblies->Framework) and check the value of the System.Windows.Forms.SystemInformation.TerminalServerSession property:

    bool isRdp = System.Windows.Forms.SystemInformation.TerminalServerSession;
    if (isRdp) { ... }


    Please refer to the following thread for more information: http://stackoverflow.com/questions/973802/detecting-remote-desktop-connection

    Hope that helps.

    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

    Sunday, March 13, 2016 5:21 PM