Yes, the authenticated user is Context.User.
To elaborate a little more, WindowsIdentity.GetCurrent() returns the current
Windows security context. This may or may not be same as the authenticated
user, depending on whether or not you have enabled impersonation in your
web.config (and whether you are using Windows authentication at all). Note
that unless you need impersonation, there is no reason to enable it. If you
don't know if you need impersonation, you probably don't.
Joe K.
"Dominick Baier [DevelopMentor]" <>
wrote in message news:. com...
> Hi,
> thats
>
> Context.User.Identity.Name
>
> ---------------------------------------
> Dominick Baier - DevelopMentor
> http://www.leastprivilege.com
>
>> I haven't been able to find a clear explanation on this one. Using
>> Visual Studio 2005, on my test environment (windows xp) the following
>> code returns the user who is logged into windows. However on the
>> server
>> (Windows 2000 server service pack 4) it returns the aspnet account.
>> Both are set to disallow anonymous access and use Integrated
>> Windows authentication.
>> Any thoughts on how I can get the username of the person hitting the
>> website would be great.
>>
>> The problem goes beyond this in that I need to check and see if
>> this user is part of a specific group on the machine, but my root
>> cause seems to be that I am not getting the correct user in the first
>> place.
>>
>> WindowsPrincipal wp = new
>> WindowsPrincipal(WindowsIdentity.GetCurrent());
>> string userName = wp.Identity.Name;
>
>