Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

Current windows user

$
0
0

I know I've done this in the past, but it was a long time ago (2005-2006).  I'm trying to get the user that is currently logged into the local machine (their username).  

I have this code:

string strUsername = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();

which is currently showing: NT AUTHORITY\NETWORK SERVICE

I have the web.config set up:

<authentication mode="Windows"/><identity impersonate="true" />

When I go into IIS and turn off anonymous authentication, then I'm getting an error that I do not have access to this page.  I can't find what I'm missing.

Thanks for your help!

Josh


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>