Link to home
Start Free TrialLog in
Avatar of bschave2
bschave2

asked on

how do I get logonuser credentials for windows authentication in vb.net?

I am trying to get a user's credentials from windows authentication for vb.net. I have done this in classic asp, but am sure it's more extensive in .NET.  Thanks in advance!
Avatar of ladarling
ladarling
Flag of United States of America image

Not sure what you mean by 'credentials'. In what context, that is. If you mean Windows domain, then you can use the My.User namespace.
You can get the qualified domain username like:
Dim myUser As String = My.User.Name
If you want to see if the user is authenticated:
If My.User.IsAuthenticated Then...
If you are trying work with another users account, you need to use impersonation: http://weblogs.asp.net/ralfw/archive/2003/11/24/39479.aspx 
Avatar of Toms Edison
You can get the user name with domain from "Context.User.Identity.Name"
Avatar of bschave2
bschave2

ASKER

credentials meaning the user's username from the windows authentication window that comes up to log in to any application.
ASKER CERTIFIED SOLUTION
Avatar of Toms Edison
Toms Edison
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sort of correct, I had to impersonate the user. Thanks for the help though.