|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Getting AD Usernameforms 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 System.Environment provides a UserName and UserDomainName properties...
-- Show quoteHide quotePatrice "Jim in Arizona" <tiltow***@hotmail.com> a écrit dans le message de news:Or3ctpbJGHA.3352@TK2MSFTNGP12.phx.gbl... > 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 wrote:
> System.Environment provides a UserName and UserDomainName properties... Perfect! Thanks Patrice.> Dim username As System.Environment Label1.Text = username.UserName Jim |
|||||||||||||||||||||||