September 16th, 2003, 03:56 AM
Join Date: Sep 2003
Time spent in forums: < 1 sec
Reputation Power: 0
How to get NT logon user id in C#?
It's been a while since I started programming in C#. Primarily I'd been working on ASP and things were easy to obtain though the method was clumsy.
However, I've been facing some problems to get the NT user ID (the currently logged in user) from the codebehind.
ASP.NET service creates an account viz. "ASPNET" (a worker account) to access the services and this account requires some privilages to be able to access the .NET service.
When I attempt to retrieve the current logged in user's id, it always returns me "MACHINE-NAME\ASPNET", as this is the account used to access the ASP.NET service.
I've tried several ways:
Returns "" (empty)
Could someone please help me out in this?