473,722 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing Session Specific Code For Windows 2003 Terminal Server Session

OHM
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 desktop ( On windows
2003 Server ), I need to determine in the code the machine name and
username. If I use GetUsername and GetMachineName, it simply gives me the
name of the currently logged on user ( at the Server ) and the Servers
Machine Name.

Any Ideas ?

Regards - Terry
Nov 20 '05 #1
8 2739
Hi Terry,

I knew this was your name from the past however I was not sure.

Did you already try this for the user (I do not know if it works on a
terminal server however it seems so obvious for me), maybe you can get his
standard workstation as well for that however that I do not know direct.

Imports System.Security .Principal

AppDomain.Curre ntDomain.SetPri ncipalPolicy(Pr incipalPolicy.W indowsPrincipal )
Dim WinPrincipal As WindowsPrincipa l = CType(Thread.Cu rrentPrincipal,
WindowsPrincipa l)
Dim user As String = WinPrincipal.Id entity.Name

Cor
Nov 20 '05 #2
OHM
Thanx Cor, I'll give it a go and see what happens, I also need to get the
calling machine name, do you have any ideas on this ?

OHM

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
Hi Terry,

I knew this was your name from the past however I was not sure.

Did you already try this for the user (I do not know if it works on a
terminal server however it seems so obvious for me), maybe you can get his
standard workstation as well for that however that I do not know direct.

Imports System.Security .Principal

AppDomain.Curre ntDomain.SetPri ncipalPolicy(Pr incipalPolicy.W indowsPrincipal ) Dim WinPrincipal As WindowsPrincipa l = CType(Thread.Cu rrentPrincipal,
WindowsPrincipa l)
Dim user As String = WinPrincipal.Id entity.Name

Cor

Nov 20 '05 #3
Hi Terry,

I do not understand your meaning very well. When we terminal to a remote
terminal server, all the process run in the terminal session is just like
we do when we logon to the terminal server locally. So if we call the
Getusername and getmachinename we will get the same result just as we do
locally on the server.

So can you tell me what do you want to do? What is your expected behavior?

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4
OHM
Hi Peter,

Basically we need to find the name of the User and the Netbios machine name
who has logged on to the terminal server. Ideally, the solution should be a
VB6 solution because thats what the code is written in, but if we can only
find a solution in .NET then we can user interop to get the info.

Cheers - OHM


""Peter Huang"" <v-******@online.m icrosoft.com> wrote in message
news:4T******** ******@cpmsftng xa10.phx.gbl...
Hi Terry,

I do not understand your meaning very well. When we terminal to a remote
terminal server, all the process run in the terminal session is just like
we do when we logon to the terminal server locally. So if we call the
Getusername and getmachinename we will get the same result just as we do
locally on the server.

So can you tell me what do you want to do? What is your expected behavior?

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #5
Hi OHM,

Can you give me a message when using that loggin information helps, I am
currious about that of course, theoratical it should work because it is the
principal who is using the application on terminal server.

However you never know.

Cor
Nov 20 '05 #6
OHM
Hi Cor,

Sorry I have not been able to try this out yet because I cant get to the
server, as soon as I have I will get back to you.

Regards - OHM
"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:Ow******** ******@TK2MSFTN GP09.phx.gbl...
Hi OHM,

Can you give me a message when using that loggin information helps, I am
currious about that of course, theoratical it should work because it is the principal who is using the application on terminal server.

However you never know.

Cor

Nov 20 '05 #7
OHM,
As Peter suggests, when you log into Terminal Server, the Terminal Server IS
the netbois machine name the user is logged into!

Do you mean the client PC where the Terminal Server client is running?

I have not tried it, but the WTSQuerySession Information API looks promising.
To get information from Terminal Server I understand you need to use
Terminal Services, which can be found at "Windows Development - Windows Base
Services - Terminal Services" it part of the Win32 API set. I really don't
know if the above is already exposed in the Framework or not.

Hope this helps
Jay
"OHM" <Me@NoWhere.Com > wrote in message
news:uz******** ******@tk2msftn gp13.phx.gbl...
Hi Peter,

Basically we need to find the name of the User and the Netbios machine name who has logged on to the terminal server. Ideally, the solution should be a VB6 solution because thats what the code is written in, but if we can only
find a solution in .NET then we can user interop to get the info.

Cheers - OHM


""Peter Huang"" <v-******@online.m icrosoft.com> wrote in message
news:4T******** ******@cpmsftng xa10.phx.gbl...
Hi Terry,

I do not understand your meaning very well. When we terminal to a remote
terminal server, all the process run in the terminal session is just like we do when we logon to the terminal server locally. So if we call the
Getusername and getmachinename we will get the same result just as we do
locally on the server.

So can you tell me what do you want to do? What is your expected behavior?
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no

rights.


Nov 20 '05 #8
OHM
Thats exactly what I was looking for.

Many Thanks Jay

OHM
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:ui******** ******@TK2MSFTN GP10.phx.gbl...
OHM,
As Peter suggests, when you log into Terminal Server, the Terminal Server IS the netbois machine name the user is logged into!

Do you mean the client PC where the Terminal Server client is running?

I have not tried it, but the WTSQuerySession Information API looks promising. To get information from Terminal Server I understand you need to use
Terminal Services, which can be found at "Windows Development - Windows Base Services - Terminal Services" it part of the Win32 API set. I really don't
know if the above is already exposed in the Framework or not.

Hope this helps
Jay
"OHM" <Me@NoWhere.Com > wrote in message
news:uz******** ******@tk2msftn gp13.phx.gbl...
Hi Peter,

Basically we need to find the name of the User and the Netbios machine name
who has logged on to the terminal server. Ideally, the solution should be a
VB6 solution because thats what the code is written in, but if we can only find a solution in .NET then we can user interop to get the info.

Cheers - OHM


""Peter Huang"" <v-******@online.m icrosoft.com> wrote in message
news:4T******** ******@cpmsftng xa10.phx.gbl...
Hi Terry,

I do not understand your meaning very well. When we terminal to a remote terminal server, all the process run in the terminal session is just

like we do when we logon to the terminal server locally. So if we call the
Getusername and getmachinename we will get the same result just as we do locally on the server.

So can you tell me what do you want to do? What is your expected behavior?
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no

rights.



Nov 20 '05 #9

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

Similar topics

3
2915
by: Geoff Winsor | last post by:
Hi, I am experiencing a problem with recalling a session variable which stores whether a person is logged in to a "members only" section of a website. This area of the site has been working flawlessly for a couple of years under Windows 2000 server but now is very inconsistent following a recent upgrade to Windows server 2003. Following a login, the login info is passed to this asp page that checks an Access database for the user name and...
1
2053
by: Gary K | last post by:
I am trying to setup remote debugging on my first client-server setup, so hopefully this problem is just stupidity on my part. The client machine is running Windows XP Pro/SP2 with Visual Studio .NET 2002 and the server is Windows Server 2003 with the Server Components installed from VS. Both machines are in the domain, and the user is an administrator of both machines and has been added to the VS Developers group & the Debugger Users group...
2
2487
by: Hans | last post by:
I am using Process.GetProcessesByName("SomeName") in my app and it workes on most windows platforms. On most - it does not work in a terminal server session on a Windows 2003 server. Although the app is strong named and the server has a code group with full access, Process.GetProcessesByName() throws a security exception. Can anybody tell me how to get this working on a terminal server??? Thanx, Hans
1
1593
by: mwolf | last post by:
I have an application written in c$ that needs to be run in 3 different terminal server sessions on a windows 2003 server. Everything will work fine for about an hour, after this point the applications thread will no longer be able to create an custom object. I will continually get the error "Object reference not set to an instance of an object" any ideas? It always seems to happen around an hour of run, and if I
9
2451
by: William LaMartin | last post by:
I have a problem, mentioned here before, of Session and Application variables disappearing at one site but not at others or on my development computer. The problem is illustrated by an example at http://www.lamartin.com/dotnet/sessiontestset.aspx, were I set Session, Application and Cache variables on the first page and then on the second page view them as the second page is refreshed every five seconds. Before 10 refreshes, the...
3
3467
by: Gary K | last post by:
After a bit a trouble getting VS to create a project on a different web server (I forgot to apply the 'fix'), I get the following error when trying to debug my web application. Error while trying to run project: Unable to start debugging on the web server. There appears to be no suitable logon session on the server. Please verify that you are logged on to the server through Terminal Services or that you are logged onto the server...
5
5283
by: fbwhite | last post by:
I know this issue has been brought up many times, but I have tried many of the solutions to no avail. I wanted to give my specific case to see if someone could be of any help. We are using the sessionstate inproc mode and users are randomly losing their session. I do not believe it is happening across all users at one time. It seems to happen to different users at different times, but I am only going off heresay. The aspnet worker...
9
2544
by: Adrian Parker | last post by:
We have a website that works everywhere but on a few PCs on this one site.. Asp.Net 1.1 Server = Windows 2003 Client = XP In the web.config we use - cookieless="false" in the browser settings they have "Always allow session cookies" set to true When the browser connects to the website the first page sets a session variable called "user_ref" to something and then calls another page. If on
6
2530
by: rekaeps | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Also, in the same scenario, I'm having trouble writing to the server's event log. Here's some details: Server and workstation both in the same workgroup Logged into server as local Administrator Logged into workstation as a local user that is only in the Users group on
0
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8739
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
6681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.