473,394 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to detect Terminal Server in VB.NET

Hi,
I need code in VB.Net to detect if the application is running on Terminal
Server.
I am using the following code. Please let me know if you see any issues in
it or if you have some better code to achieve this functionality:

Dim sTemp As String = Environment.GetEnvironmentVariable("SESSIONNAME")
Dim IsTSSession As String
If (sTemp <> "") And (sTemp.IndexOf("RDP-") = 0) Then
IsTSSession = True
Else
IsTSSession = False
End If

Thanks,
Hitesh
Mar 2 '06 #1
2 8532
I am using the following code. Please let me know if you see any issues in
it or if you have some better code to achieve this functionality:


In .NET 2.0 you can check
System.Windows.Forms.SystemInformation.TerminalSer verSession. In
earlier versions you can call the GetSystemMetrics(SM_REMOTESESSION)
API.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Mar 2 '06 #2
Thanks very much for replying..
But can you please let me know how to use GetSystemMetrics(SM_REMOTESESSION)
in Vb.Net code.
Also do you see any issues in the code that I am using?...

"Mattias Sjögren" wrote:
I am using the following code. Please let me know if you see any issues in
it or if you have some better code to achieve this functionality:


In .NET 2.0 you can check
System.Windows.Forms.SystemInformation.TerminalSer verSession. In
earlier versions you can call the GetSystemMetrics(SM_REMOTESESSION)
API.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Mar 4 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: OHM | last post by:
Hi peoples, I dont know where to place this question, so as I know you guys are all resourceful experts, I thought I would try here. I am writing some code which will be run usingh remote...
2
by: Kevin Hodgson | last post by:
Is there any way in a .NET App to detect if it is being run under Terminal Server? I have some functions of my program (like launching emails, and saving files) that need to be handled...
6
by: Atley | last post by:
I have a Terminal Services server running Windows 2000 Server. I need to be able to identify, in my application on that server, which client computer is addressing that server and running that...
2
by: Oenone | last post by:
Is it possible to detect whether my application is running within a Terminal Server session or not? I'd like to automatically switch off some of my graphics rendering under this environment as...
9
by: Tim | last post by:
Hi Guys, I was wondering if there is a way to detect from with a C# app if it is being started in a remote session? i.e. someone has connected via remote desktop or terminal services... ...
6
by: Smokey Grindle | last post by:
is there any way to detect if yoru app is runnign on a terminal server in ..net? so we can slim down graphics and such for it? thanks!
2
by: Robin Becker | last post by:
I'm using subprocess to carry out svn commands (probably should use the svn api package, but that's a dependency too far). Anyhow my code looks like from subprocess import Popen, PIPE p =...
7
by: mike | last post by:
We have numerous Access 97 apps that we run on our Terminal Server, but two apps in particular is giving us a problem. The problem we are running into is when you select a drop down menu, it errors...
16
by: =?Utf-8?B?RHdlZWJlcmVsbGE=?= | last post by:
I created an Access 2007 application for my customer. The application is shared by three employees on a server. It maintains a contact list including financial data and social security numbers. ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.