code_junkie

getting domainusername for web app on intranet without loggin in

Nov 12th, 2011
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
  2.  
  3. WindowsPrincipal principal = (WindowsPrincipal)Thread.CurrentPrincipal;
  4. WindowsIdentity identity = (WindowsIdentity)principal.Identity;
  5.  
  6. String userName= principal.Identity.Name;
Add Comment
Please, Sign In to add comment