Access Denied on WindowsIdentity.GetCurrent()

M

Marco Herrn

Hi,

I am developing an ASP.NET Application in C#. I need to find out the
user under which the process is running on runtime. So I use
System.Security.Principal.WindowsIdentity.GetCurrent().Name to get the
name of the current user. But I get this exception:

Exception: System.ApplicationException
Message: Access is denied.

Source: mscorlib
at System.Security.Principal.WindowsIdentity._ResolveIdentity(IntPtr
userToken)
at System.Security.Principal.WindowsIdentity.get_Name()


What is the reason for this? Calling
System.Security.Principal.WindowsIdentity.GetCurrent().IsAuthenticated
does not lead to this exception! So what can the reason be?

Regards
Marco
 
P

Paul Clement

¤ Hi,
¤
¤ I am developing an ASP.NET Application in C#. I need to find out the
¤ user under which the process is running on runtime. So I use
¤ System.Security.Principal.WindowsIdentity.GetCurrent().Name to get the
¤ name of the current user. But I get this exception:
¤
¤ Exception: System.ApplicationException
¤ Message: Access is denied.
¤
¤ Source: mscorlib
¤ at System.Security.Principal.WindowsIdentity._ResolveIdentity(IntPtr
¤ userToken)
¤ at System.Security.Principal.WindowsIdentity.get_Name()
¤
¤
¤ What is the reason for this? Calling
¤ System.Security.Principal.WindowsIdentity.GetCurrent().IsAuthenticated
¤ does not lead to this exception! So what can the reason be?
¤
¤ Regards
¤ Marco

Which level of authentication is your web app implementing? You don't have Anonymous turned on do
you?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top