Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%
- Dim objLogon
- ' create an object for impersonating IIS to use a valid domain user instead of anonymous user IUSR_machinename
- Set objLogon = Server.CreateObject("LoginAdmin.ImpersonateUser")
- ' any domain user who has rights to access active directory
- objLogon.Logon "user id", "password", "domain name"
- ' check here for a form post ...
- if request("GETUSER") = "" Then
- ' write out the form
- With Response
- .write "<p><h3>Active Directory Login Form</h3></p><br>"
- .write "<FORM ACTION=login.asp METHOD=POST>"
- .write "<INPUT TYPE=TEXT NAME=oUSer>ENTER USER NAME TO CHECK<BR>"
- .write "<INPUT TYPE=PASSWORD NAME=oPassword>ENTER USER PASSWORD<BR>"
- .Write "<INPUT TYPE =SUBMIT NAME=GETUSER VALUE=CHECK>"
- .write "</FORM>"
- end with
- else
- ' Form was autopostback, grab the form variables ...
- strUser = Request("oUser")
- strPassword = Request("oPassword")
- Set oUser = Server.CreateObject("prjLogin.clsDomainLogin")
- ' BindObject has two parameters userid and password
- iResult = oUser.BindObject(strUser, strPassword, "localhost")
- 'on error resume next
- ' Set reference to the ADSI interface to NT User Manager ...
- Response.write "<p><h4>Output</h4></p>"
- if iResult = 1 then
- Response.write "<br>Login success!"
- ' Whatever you want to process here
- else
- Response.write "<br>BAD PASSWORD!"
- ' Whatever you want to process here
- end if
- set oUser = Nothing
- end if
- objLogon.Logoff
- Set objLogon = Nothing
- %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement