Retriving NT Login Name and password
OK, i making a program that will be used by multiple users. Now each user will have different Privilages for editing/creating new enteries in about 6 different catagories. Now I want to pull out their Windows NT login Name and password. So i can use that for permission settings. As well as the connection string to the SQL Sever that we are using. Now I have tired this.
| |
PrivateSub Login_Load(ByVal senderAs System.Object,ByVal eAs System.EventArgs)HandlesMyBase.Load ID.Text = ntname ID.Select() EndSubPrivateReadOnlyProperty ntname()AsString Get Dim idAs IIdentity Return id.Name EndGet EndProperty
|
Now it says id is used before it is not assigned a value before use. So I need help on this one.
Hi Glenn,
there is no straightforward way to retrieve the password of an NT user. This is because you are not supposed to, even if you find a hack to do it.
If you want to authenticate a user by validating his/her password, you will have to pass the password that the user entered in a textbox (for instance) to an the authentication provider of NT which will returned you a boolean value.
If you are using VB8 you might try using the ActiveDirectoryMembershipProvider under the System.Web.Security namespace. You can use it even if you are not developing a web application.
ActiveDirectoryMembershipProvider.ValidateUser takes username and password as arguments and returns true if the username and password correspond to a valid NT user.
Dipapadi
>Is there a way to save automaticaly or read it from the machine?
No, it's never saved anywhere, only it's hashcode is.