Getting AD Username

  • Thread starter Thread starter Jim in Arizona
  • Start date Start date
J

Jim in Arizona

I'm more used to making webforms using ASPNET than I am doing windows
forms programming.

I was trying to figure out how I could get the current users logon name
so that I can manipulate code based on who they are. I tried this:

Dim username As System.Net.NetworkCredential
Label1.Text = username.UserName

That didn't help me out much.

In a web form, I would do something like this:

strUsername = httpcontext.current.user.identity.name

That would return the current user's active directory username in the
form of domain\username.


TIA,
Jim
 
Patrice said:
System.Environment provides a UserName and UserDomainName properties...

Perfect! Thanks Patrice.

Dim username As System.Environment
Label1.Text = username.UserName

Jim
 
Back
Top