Get authenticated username

System.Security.Principal.IIdentity CurrentUserIdentity = HttpContext.Current.User.Identity;
System.Security.Principal.WindowsIdentity CurrentUserWindowsIdentity = (System.Security.Principal.WindowsIdentity)CurrentUserIdentity;
System.Diagnostics.Debug.Write(CurrentUserWindowsIdentity.Name);

No comments:

Post a Comment