?
Solved

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

Posted on 2008-10-23
5
Medium Priority
?
928 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 2000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

777 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