Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
This is code to authenticate a domain user through...
Author:
R. Keith
E-mail:
Click to e-mail author
Submitted:
1/24/2003
Version:
VB5
Compatibility:
VB5, VB6
Category:
Security
Views:
16806
This is code to authenticate a domain user through ADSI. The code can be lightly modified to work in Visual Basic. Replace YourDomainGoesHere with your domain name and pass username and password through a form. I use this to authenicate users on an Intranet without using the security in IIS.
Declarations:
'none
Code:
<% on error resume next strUserName = Request.Form("username") strPassword = Request.Form("password") strADsPath = "WinNT://YourDomainGoesHere" iFlags = "0" ' bind to the ADSI object and authenticate Username and password Set oADsObject = GetObject(strADsPath) strADsNamespace = left(strADsPath, instr(strADsPath, ":")) set oADsNamespace = GetObject(strADsNamespace) Set oADsObject = oADsNamespace.OpenDSObject(strADsPath, "YourDomainGoesHere\" & strUserName, strPassword, 0) ' we're only bound if err.number = 0 If not (Err.number = 0) then response.write "
Login Failed:
" response.write "
unknown username or password
" Else response.write "
Authenicated!
" End If %>
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement