Modify NT User Password (EXT) through ASP

Source: Internet
Author: User
Tags servervariables
HTML section

When a user is logged into the security area of your site, you can use the Login_user in the ServerVariables collection to understand the logged in user account, and of course remember to turn off the Allow anonymous login, and now look at the HTML section first.

<form action= "changepwd.asp" method= "POST" >
<!--use hidden--> in order not to allow users to enter accounts themselves
<input type= "hidden" name= "UserName"
Value= "<%=request.servervariables (" Login_user ")%>" >
<br> Enter old password: <input name= "Oldpwd" >
<br> Enter new password: <input name= "NEWPWD1" >
<br> Confirm New Password: <input name= "NEWPWD2" >
<input type= "Submit" value= "Change Password" >
</form>

Program code

The next part of the ASP, see how to modify the WIndows 2000 user account through ADSI, and save the bottom program code as a changepwd.asp file name

<%
Oldpwd = Request.Form ("Oldpwd")
NEWPWD1 = Request.Form ("NewPwd1")
NEWPWD2 = Request.Form ("NewPwd2")
UserName = Request.Form ("UserName")

If NewPwd1 = NewPwd2 Then
Set ouser = GetObject ("winnt://computername/" & UserName)
Ouser.changepassword Oldpwd, NEWPWD1
Ouser.setinfo
Set ouser = Nothing
Else
Response.Write, "Please reconfirm your password."
End If
%>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.