Solved

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

Posted on 2008-10-23
5
923 Views
Last Modified: 2010-04-21
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!
0
Comment
Question by:bschave2
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:ladarling
ID: 22785894
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
0
 
LVL 13

Expert Comment

by:TechTiger007
ID: 22785897
You can get the user name with domain from "Context.User.Identity.Name"
0
 

Author Comment

by:bschave2
ID: 22785964
credentials meaning the user's username from the windows authentication window that comes up to log in to any application.
0
 
LVL 13

Accepted Solution

by:
TechTiger007 earned 500 total points
ID: 22786039
In asp.net if the user has logged in to the application through the windows authentication window you can get his name  by "Context.User.Identity.Name" this will have the value as "domainname\username"
0
 

Author Closing Comment

by:bschave2
ID: 31509186
sort of correct, I had to impersonate the user. Thanks for the help though.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now