Solved

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

Posted on 2008-10-23
5
927 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

705 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