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
Solved

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

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

789 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