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.



Private Sub Login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   ID.Text = ntname
   ID.Select()
End Sub

Private ReadOnly Property ntname() As String
   
Get
      Dim id As IIdentity
      Return id.Name
   End Get
End Property

 


Now it says id is used before it is not assigned a value before use. So I need help on this one.


Answer this question

Retriving NT Login Name and password

  • Bates

    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

  • eralper

    I does but Users'll have to save their password also in the aspnetdb.

    Is there a way to save automaticaly or read it from the machine

    Thanks


  • KarlaK

    >Is there a way to save automaticaly or read it from the machine

    No, it's never saved anywhere, only it's hashcode is.


  • Retriving NT Login Name and password