Solved

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

Posted on 2008-10-23
5
924 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
consuming an asmx web service in winforms application 3 24
scanning dentists xray (the small ones) 3 41
C# HTTP GET method sample code 3 37
how to read json value 2 27
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

939 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

10 Experts available now in Live!

Get 1:1 Help Now