Results 1 to 6 of 6

Thread: Login using NT username and password

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2004
    Location
    kansas
    Posts
    18

    Login using NT username and password

    Can anyone point me in the right direction on how to create a login page where the user must use their NT username and password. I'm writing a VB.NET program and I can't create my own login tables because the powers that be want only one username and password to remember.

    Thanks.
    Mike

  2. #2
    Addicted Member corwin_ranger's Avatar
    Join Date
    Sep 2004
    Location
    CT
    Posts
    198
    You could potentially use the Environment class, specifically the Environment.UserDomainName and the Environment.UserName properties to read the info you're looking for you could assign that to a variable:

    Code:
    Dim strUserName As String
    
    strUserName = Environment.UserDomainName & "\" & _
    Environment.UserName
    MessageBox.Show(strUserName)
    As a newbie, my thinking may be flawed here, plus I don't know anything else about your app, but I would think that you could compare that name against a dataset that you maintained to determine permisions.

    I aslo wonder if someone else might know if there's a way to look up groups membership against the domain. If that were possible, and I would imagine that it is, you could very easily use that technique to establish permissions.

    Keep in mind that I have absolutely no knowledge if what techniques are recommended for securing an application, so me idea, while it would work may not be considered to be a preferred or even an accepted method.

    By the way, this technique would eliminate the need for a login dialog, since who the user is is already established.

    I hope my $.02 helped.

    Steve

  3. #3
    Addicted Member
    Join Date
    Sep 2004
    Location
    Brooklyn
    Posts
    147
    What exactly do you want to use the username and password for?

    You can use System.Security.Principal.WindowsIdentity.Name to get their logon name, and/or System.Security.Principal.WindowsIdentity.IsAuthenticated to determine if they are authenticated. I don't know of any way to get their password though (for obvious security reasons, there may not be a way).

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Aug 2004
    Location
    kansas
    Posts
    18
    I'm not so much looking for a password, what I really need to do is validate them before they enter my program. I certainly am not looking for their password, I just need to be able to have different people logon to the app from potentially the same machine.

    A co-worker of mine has an idea so I'll get back to you with an answer (hopefully) and post it here for anyone interested.

    Thanks again for the replies.

    Mike

  5. #5
    Lively Member
    Join Date
    Sep 2004
    Location
    Burlington, North Carolina
    Posts
    78
    Mike -

    I'm certainly interested! I've been thinking about this subject lately as I've got a potential use for using 'Windows Authentication' to allow users into an application and/or areas of a web...

    I'll be looking for your post.

  6. #6
    Addicted Member
    Join Date
    Sep 2004
    Location
    Brooklyn
    Posts
    147
    There are easy methods in ASP.NET to authenticate users to a local machine or a windows domain, and I'm guessing there similar easy methods to do the same in other parts of the .NET framework, but I'm not familiar with them.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width