Tips and tricks for .NET using ASP and VB code.

Get current username

        Dim CurrentUserIdentity As System.Security.Principal.IIdentity = HttpContext.Current.User.Identity
Dim CurrentUserWindowsIdentity As System.Security.Principal.WindowsIdentity = DirectCast(CurrentUserIdentity, System.Security.Principal.WindowsIdentity)
System.Diagnostics.Debug.Write(CurrentUserWindowsIdentity.Name)

No comments:

Post a Comment

Search This Blog