DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 1 of 2 12 LastLast
Results 1 to 15 of 23

Thread: To check the NT password with user name through VB?

  1. #1
    Ashwini Guest

    To check the NT password with user name through VB?


    Does anybody know how to check the NT password and User name with the domain
    name through VB ? I want to use the same security for the other my application..


  2. #2
    Raul M. Fragoso Guest

    Re: To check the NT password with user name through VB?

    Hi,

    You can use the LogonUser API function. It works fine for my applications.

    Hope this helps,
    --
    Raul M. Fragoso
    raulf@zip.net



    "Ashwini" <JAshwini12@yahoo.com> wrote in message
    news:3a88df49$1@news.devx.com...
    >
    > Does anybody know how to check the NT password and User name with the

    domain
    > name through VB ? I want to use the same security for the other my

    application..
    >




  3. #3
    Raul M. Fragoso Guest

    Re: To check the NT password with user name through VB?

    Hi,

    You can use the LogonUser API function. It works fine for my applications.

    Hope this helps,
    --
    Raul M. Fragoso
    raulf@zip.net



    "Ashwini" <JAshwini12@yahoo.com> wrote in message
    news:3a88df49$1@news.devx.com...
    >
    > Does anybody know how to check the NT password and User name with the

    domain
    > name through VB ? I want to use the same security for the other my

    application..
    >




  4. #4
    Paul Clement Guest

    Re: To check the NT password with user name through VB?

    On 12 Feb 2001 23:16:25 -0800, "Ashwini" <JAshwini12@yahoo.com> wrote:


    Does anybody know how to check the NT password and User name with the domain
    name through VB ? I want to use the same security for the other my application..

    You could use LogonUser on the client, but you have to be running under NT/Win2K. Here's a link to a
    couple of solutions:

    http://www.devx.com/gethelp/newinquiry.asp?ItemID=4767


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

  5. #5
    Paul Clement Guest

    Re: To check the NT password with user name through VB?

    On 12 Feb 2001 23:16:25 -0800, "Ashwini" <JAshwini12@yahoo.com> wrote:


    Does anybody know how to check the NT password and User name with the domain
    name through VB ? I want to use the same security for the other my application..

    You could use LogonUser on the client, but you have to be running under NT/Win2K. Here's a link to a
    couple of solutions:

    http://www.devx.com/gethelp/newinquiry.asp?ItemID=4767


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

  6. #6
    Ashwini Guest

    Re: To check the NT password with user name through VB?


    Thanks for ur response.

    I have declared the funstion like --
    Private Declare Function LogonUser
    Lib "Advapi32" Alias "LogonUserA" (ByVal lpszUsername As String, _
    ByVal lpszDomain As Any, ByVal lpszPassword As String, _
    ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, _
    phToken As Long) As Long

    and called it as
    lngResult = LogonUser(Trim(txtUserName.Text), strDomain, Trim(txtPassword.Text),
    LOGON32_LOGON_BATCH, LOGON32_PROVIDER_DEFAULT, 1)
    Now for correct combination of username, password & Domain .. it is suppose
    to return nonzero value.. but always it is returning zero value.. for correct
    as well as incorrect combination..
    If u can help to solve this.. will be really appriciated.

    Thanks once again..

    Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote:
    >On 12 Feb 2001 23:16:25 -0800, "Ashwini" <JAshwini12@yahoo.com> wrote:
    >
    >
    > Does anybody know how to check the NT password and User name with the

    domain
    > name through VB ? I want to use the same security for the other my application..
    >
    >You could use LogonUser on the client, but you have to be running under

    NT/Win2K. Here's
    >a link to a
    >couple of solutions:
    >
    >http://www.devx.com/gethelp/newinquiry.asp?ItemID=4767
    >
    >
    >Paul ~~~ pclement@ameritech.net
    >Microsoft MVP (Visual Basic)



  7. #7
    Ashwini Guest

    Re: To check the NT password with user name through VB?


    Thanks for ur response.

    I have declared the funstion like --
    Private Declare Function LogonUser
    Lib "Advapi32" Alias "LogonUserA" (ByVal lpszUsername As String, _
    ByVal lpszDomain As Any, ByVal lpszPassword As String, _
    ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, _
    phToken As Long) As Long

    and called it as
    lngResult = LogonUser(Trim(txtUserName.Text), strDomain, Trim(txtPassword.Text),
    LOGON32_LOGON_BATCH, LOGON32_PROVIDER_DEFAULT, 1)
    Now for correct combination of username, password & Domain .. it is suppose
    to return nonzero value.. but always it is returning zero value.. for correct
    as well as incorrect combination..
    If u can help to solve this.. will be really appriciated.

    Thanks once again..

    Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote:
    >On 12 Feb 2001 23:16:25 -0800, "Ashwini" <JAshwini12@yahoo.com> wrote:
    >
    >
    > Does anybody know how to check the NT password and User name with the

    domain
    > name through VB ? I want to use the same security for the other my application..
    >
    >You could use LogonUser on the client, but you have to be running under

    NT/Win2K. Here's
    >a link to a
    >couple of solutions:
    >
    >http://www.devx.com/gethelp/newinquiry.asp?ItemID=4767
    >
    >
    >Paul ~~~ pclement@ameritech.net
    >Microsoft MVP (Visual Basic)



  8. #8
    Hemant Guest

    Re: To check the NT password with user name through VB?


    Try using the ADSI function OpenDSObject with the username and password given.
    If it succussfully opens,you are there.

    Hemant.


    "Ashwini" <JAshwini12@yahoo.com> wrote:
    >
    >Thanks for ur response.
    >
    >I have declared the funstion like --
    > Private Declare Function LogonUser
    > Lib "Advapi32" Alias "LogonUserA" (ByVal lpszUsername As String, _
    > ByVal lpszDomain As Any, ByVal lpszPassword As String, _
    > ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, _
    > phToken As Long) As Long
    >
    >and called it as
    > lngResult = LogonUser(Trim(txtUserName.Text), strDomain, Trim(txtPassword.Text),
    >LOGON32_LOGON_BATCH, LOGON32_PROVIDER_DEFAULT, 1)
    >Now for correct combination of username, password & Domain .. it is suppose
    >to return nonzero value.. but always it is returning zero value.. for correct
    >as well as incorrect combination..
    >If u can help to solve this.. will be really appriciated.
    >
    >Thanks once again..
    >
    >Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote:
    >>On 12 Feb 2001 23:16:25 -0800, "Ashwini" <JAshwini12@yahoo.com> wrote:
    >>
    >>
    >> Does anybody know how to check the NT password and User name with the

    >domain
    >> name through VB ? I want to use the same security for the other my application..
    >>
    >>You could use LogonUser on the client, but you have to be running under

    >NT/Win2K. Here's
    >>a link to a
    >>couple of solutions:
    >>
    >>http://www.devx.com/gethelp/newinquiry.asp?ItemID=4767
    >>
    >>
    >>Paul ~~~ pclement@ameritech.net
    >>Microsoft MVP (Visual Basic)

    >



  9. #9
    Hemant Guest

    Re: To check the NT password with user name through VB?


    Try using the ADSI function OpenDSObject with the username and password given.
    If it succussfully opens,you are there.

    Hemant.


    "Ashwini" <JAshwini12@yahoo.com> wrote:
    >
    >Thanks for ur response.
    >
    >I have declared the funstion like --
    > Private Declare Function LogonUser
    > Lib "Advapi32" Alias "LogonUserA" (ByVal lpszUsername As String, _
    > ByVal lpszDomain As Any, ByVal lpszPassword As String, _
    > ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, _
    > phToken As Long) As Long
    >
    >and called it as
    > lngResult = LogonUser(Trim(txtUserName.Text), strDomain, Trim(txtPassword.Text),
    >LOGON32_LOGON_BATCH, LOGON32_PROVIDER_DEFAULT, 1)
    >Now for correct combination of username, password & Domain .. it is suppose
    >to return nonzero value.. but always it is returning zero value.. for correct
    >as well as incorrect combination..
    >If u can help to solve this.. will be really appriciated.
    >
    >Thanks once again..
    >
    >Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote:
    >>On 12 Feb 2001 23:16:25 -0800, "Ashwini" <JAshwini12@yahoo.com> wrote:
    >>
    >>
    >> Does anybody know how to check the NT password and User name with the

    >domain
    >> name through VB ? I want to use the same security for the other my application..
    >>
    >>You could use LogonUser on the client, but you have to be running under

    >NT/Win2K. Here's
    >>a link to a
    >>couple of solutions:
    >>
    >>http://www.devx.com/gethelp/newinquiry.asp?ItemID=4767
    >>
    >>
    >>Paul ~~~ pclement@ameritech.net
    >>Microsoft MVP (Visual Basic)

    >



  10. #10
    Paul Clement Guest

    Re: To check the NT password with user name through VB?

    On 21 Feb 2001 22:22:37 -0800, "Ashwini" <JAshwini12@yahoo.com> wrote:


    Thanks for ur response.

    I have declared the funstion like --
    Private Declare Function LogonUser
    Lib "Advapi32" Alias "LogonUserA" (ByVal lpszUsername As String, _
    ByVal lpszDomain As Any, ByVal lpszPassword As String, _
    ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, _
    phToken As Long) As Long

    and called it as
    lngResult = LogonUser(Trim(txtUserName.Text), strDomain, Trim(txtPassword.Text),
    LOGON32_LOGON_BATCH, LOGON32_PROVIDER_DEFAULT, 1)
    Now for correct combination of username, password & Domain .. it is suppose
    to return nonzero value.. but always it is returning zero value.. for correct
    as well as incorrect combination..
    If u can help to solve this.. will be really appriciated.


    Make certain to read the explanation in the following article. It could be that the user ID does not
    have the required privileges. In addition I don't know where you are running this from but the
    preferred method would be to run it from a component (using DCOM or MTS) on the server.

    http://www.inquiry.com/techtips/nt_p.../10min0498.asp


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

  11. #11
    Paul Clement Guest

    Re: To check the NT password with user name through VB?

    On 21 Feb 2001 22:22:37 -0800, "Ashwini" <JAshwini12@yahoo.com> wrote:


    Thanks for ur response.

    I have declared the funstion like --
    Private Declare Function LogonUser
    Lib "Advapi32" Alias "LogonUserA" (ByVal lpszUsername As String, _
    ByVal lpszDomain As Any, ByVal lpszPassword As String, _
    ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, _
    phToken As Long) As Long

    and called it as
    lngResult = LogonUser(Trim(txtUserName.Text), strDomain, Trim(txtPassword.Text),
    LOGON32_LOGON_BATCH, LOGON32_PROVIDER_DEFAULT, 1)
    Now for correct combination of username, password & Domain .. it is suppose
    to return nonzero value.. but always it is returning zero value.. for correct
    as well as incorrect combination..
    If u can help to solve this.. will be really appriciated.


    Make certain to read the explanation in the following article. It could be that the user ID does not
    have the required privileges. In addition I don't know where you are running this from but the
    preferred method would be to run it from a component (using DCOM or MTS) on the server.

    http://www.inquiry.com/techtips/nt_p.../10min0498.asp


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

  12. #12
    Ashwini Guest

    Re: To check the NT password with user name through VB?


    Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote:
    >On 21 Feb 2001 22:22:37 -0800, "Ashwini" <JAshwini12@yahoo.com> wrote:
    >
    >
    > Thanks for ur response.
    >
    > I have declared the funstion like --
    > Private Declare Function LogonUser
    > Lib "Advapi32" Alias "LogonUserA" (ByVal lpszUsername As String, _
    > ByVal lpszDomain As Any, ByVal lpszPassword As String, _
    > ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, _
    > phToken As Long) As Long
    >
    > and called it as
    > lngResult = LogonUser(Trim(txtUserName.Text), strDomain, Trim(txtPassword.Text),

    LOGON32_LOGON_BATCH, LOGON32_PROVIDER_DEFAULT, 1)
    > Now for correct combination of username, password & Domain .. it is suppose
    > to return nonzero value.. but always it is returning zero value.. for

    correct
    > as well as incorrect combination..
    > If u can help to solve this.. will be really appriciated.
    >
    >
    >Make certain to read the explanation in the following article. It could

    be that the
    >user ID does not
    >have the required privileges. In addition I don't know where you are running

    this from
    >but the
    >preferred method would be to run it from a component (using DCOM or MTS)

    on the server.
    >
    >http://www.inquiry.com/techtips/nt_p.../10min0498.asp
    >
    >
    >Paul ~~~ pclement@ameritech.net
    >Microsoft MVP (Visual Basic)


    I have read the article..
    Mainly want to use this on Win NT .. where tested the code on both.
    with administrator login. Administrator has all the privilages..
    We get the same named API with two libraries.. 1 "Advapi32" & "Kernel32"

    Tried both the libraries..
    i have described the result of the LogonUser of library "advapi32" above..
    Where "Kernel32" gives an error "Can't Find DLL entry point LogonUserA
    in kernel32 "

    Both the libraries are giving same results on NT and 2000
    Finally can't get the result is the Passwrod for specified user for the
    perticuler Domain name is correct or not.?





  13. #13
    Ashwini Guest

    Re: To check the NT password with user name through VB?


    Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote:
    >On 21 Feb 2001 22:22:37 -0800, "Ashwini" <JAshwini12@yahoo.com> wrote:
    >
    >
    > Thanks for ur response.
    >
    > I have declared the funstion like --
    > Private Declare Function LogonUser
    > Lib "Advapi32" Alias "LogonUserA" (ByVal lpszUsername As String, _
    > ByVal lpszDomain As Any, ByVal lpszPassword As String, _
    > ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, _
    > phToken As Long) As Long
    >
    > and called it as
    > lngResult = LogonUser(Trim(txtUserName.Text), strDomain, Trim(txtPassword.Text),

    LOGON32_LOGON_BATCH, LOGON32_PROVIDER_DEFAULT, 1)
    > Now for correct combination of username, password & Domain .. it is suppose
    > to return nonzero value.. but always it is returning zero value.. for

    correct
    > as well as incorrect combination..
    > If u can help to solve this.. will be really appriciated.
    >
    >
    >Make certain to read the explanation in the following article. It could

    be that the
    >user ID does not
    >have the required privileges. In addition I don't know where you are running

    this from
    >but the
    >preferred method would be to run it from a component (using DCOM or MTS)

    on the server.
    >
    >http://www.inquiry.com/techtips/nt_p.../10min0498.asp
    >
    >
    >Paul ~~~ pclement@ameritech.net
    >Microsoft MVP (Visual Basic)


    I have read the article..
    Mainly want to use this on Win NT .. where tested the code on both.
    with administrator login. Administrator has all the privilages..
    We get the same named API with two libraries.. 1 "Advapi32" & "Kernel32"

    Tried both the libraries..
    i have described the result of the LogonUser of library "advapi32" above..
    Where "Kernel32" gives an error "Can't Find DLL entry point LogonUserA
    in kernel32 "

    Both the libraries are giving same results on NT and 2000
    Finally can't get the result is the Passwrod for specified user for the
    perticuler Domain name is correct or not.?





  14. #14
    Rune Bivrin Guest

    Re: To check the NT password with user name through VB?

    You might want to look at Err.LastDLLError to se what is going on. That's
    where VB puts the return from GetLastError().
    Also, why are you passing 1 for the last parameter? You should be passing a
    Long value to receive the token.
    Third, I think I would declare the function with ByVal lpszDomain As String.

    HTH,
    Rune Bivrin
    "Ashwini" <JAshwini12@yahoo.com> wrote in message
    news:3a9b9bc3$1@news.devx.com...
    >
    > Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote:
    > >On 21 Feb 2001 22:22:37 -0800, "Ashwini" <JAshwini12@yahoo.com> wrote:
    > >
    > >
    > > Thanks for ur response.
    > >
    > > I have declared the funstion like --
    > > Private Declare Function LogonUser
    > > Lib "Advapi32" Alias "LogonUserA" (ByVal lpszUsername As String, _
    > > ByVal lpszDomain As Any, ByVal lpszPassword As String, _
    > > ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, _
    > > phToken As Long) As Long
    > >
    > > and called it as
    > > lngResult = LogonUser(Trim(txtUserName.Text), strDomain,

    Trim(txtPassword.Text),
    > LOGON32_LOGON_BATCH, LOGON32_PROVIDER_DEFAULT, 1)
    > > Now for correct combination of username, password & Domain .. it is

    suppose
    > > to return nonzero value.. but always it is returning zero value.. for

    > correct
    > > as well as incorrect combination..
    > > If u can help to solve this.. will be really appriciated.
    > >
    > >
    > >Make certain to read the explanation in the following article. It could

    > be that the
    > >user ID does not
    > >have the required privileges. In addition I don't know where you are

    running
    > this from
    > >but the
    > >preferred method would be to run it from a component (using DCOM or MTS)

    > on the server.
    > >
    > >http://www.inquiry.com/techtips/nt_p.../10min0498.asp
    > >
    > >
    > >Paul ~~~ pclement@ameritech.net
    > >Microsoft MVP (Visual Basic)

    >
    > I have read the article..
    > Mainly want to use this on Win NT .. where tested the code on both.
    > with administrator login. Administrator has all the privilages..
    > We get the same named API with two libraries.. 1 "Advapi32" & "Kernel32"
    >
    > Tried both the libraries..
    > i have described the result of the LogonUser of library "advapi32"

    above..
    > Where "Kernel32" gives an error "Can't Find DLL entry point LogonUserA
    > in kernel32 "
    >
    > Both the libraries are giving same results on NT and 2000
    > Finally can't get the result is the Passwrod for specified user for the
    > perticuler Domain name is correct or not.?
    >
    >
    >
    >




  15. #15
    Rune Bivrin Guest

    Re: To check the NT password with user name through VB?

    You might want to look at Err.LastDLLError to se what is going on. That's
    where VB puts the return from GetLastError().
    Also, why are you passing 1 for the last parameter? You should be passing a
    Long value to receive the token.
    Third, I think I would declare the function with ByVal lpszDomain As String.

    HTH,
    Rune Bivrin
    "Ashwini" <JAshwini12@yahoo.com> wrote in message
    news:3a9b9bc3$1@news.devx.com...
    >
    > Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote:
    > >On 21 Feb 2001 22:22:37 -0800, "Ashwini" <JAshwini12@yahoo.com> wrote:
    > >
    > >
    > > Thanks for ur response.
    > >
    > > I have declared the funstion like --
    > > Private Declare Function LogonUser
    > > Lib "Advapi32" Alias "LogonUserA" (ByVal lpszUsername As String, _
    > > ByVal lpszDomain As Any, ByVal lpszPassword As String, _
    > > ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, _
    > > phToken As Long) As Long
    > >
    > > and called it as
    > > lngResult = LogonUser(Trim(txtUserName.Text), strDomain,

    Trim(txtPassword.Text),
    > LOGON32_LOGON_BATCH, LOGON32_PROVIDER_DEFAULT, 1)
    > > Now for correct combination of username, password & Domain .. it is

    suppose
    > > to return nonzero value.. but always it is returning zero value.. for

    > correct
    > > as well as incorrect combination..
    > > If u can help to solve this.. will be really appriciated.
    > >
    > >
    > >Make certain to read the explanation in the following article. It could

    > be that the
    > >user ID does not
    > >have the required privileges. In addition I don't know where you are

    running
    > this from
    > >but the
    > >preferred method would be to run it from a component (using DCOM or MTS)

    > on the server.
    > >
    > >http://www.inquiry.com/techtips/nt_p.../10min0498.asp
    > >
    > >
    > >Paul ~~~ pclement@ameritech.net
    > >Microsoft MVP (Visual Basic)

    >
    > I have read the article..
    > Mainly want to use this on Win NT .. where tested the code on both.
    > with administrator login. Administrator has all the privilages..
    > We get the same named API with two libraries.. 1 "Advapi32" & "Kernel32"
    >
    > Tried both the libraries..
    > i have described the result of the LogonUser of library "advapi32"

    above..
    > Where "Kernel32" gives an error "Can't Find DLL entry point LogonUserA
    > in kernel32 "
    >
    > Both the libraries are giving same results on NT and 2000
    > Finally can't get the result is the Passwrod for specified user for the
    > perticuler Domain name is correct or not.?
    >
    >
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center