Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

login using windows user names and passwords

Status
Not open for further replies.

Terminus

IS-IT--Management
Jul 16, 2003
31
0
0
GB
Hi there,

i was wondering how i can access users user names and passwords from their windows login accounts. can ne1 help me??

Thanks

Terminus
 
Teminus, you can use ADSI... something like this:

Code:
<%
oUser = request.form("oUser")
oPword = request.form("oPword")

'connect to NT Domain using ADSI
     
on error resume next

Set objUser = GetObject("WinNT://" & "windomain" & "/" & oUser)

'check login
     
if err.number <> 0 then
%>
<script>
alert("Login Error!")
history.back(1);
</script>
<%
end if
               
' check if user exists               
     
If len(objUser.FullName) < 1 then
%>
<script>
alert("Invalid domain account!")
history.back(1);
</script>
<%

else

on error resume next
 
 'check password
           
objUser.ChangePassword  oPword, oPword
          
if err.number <> 0 then

%>

<script>
alert("Incorrect Password!")
history.back(1);
</script>

<%

else
               
response.redirect "mainpage.asp?QryFullName="&objUser.FullName&"&QryUser="&oUser&""

end if                     
end if     
...etc etc etc

hope this helps,

alfredo
 
Many thanks,

Will this work on win2003 based server ?

terminus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top