Change a NT password on a webpage. (웹페이지에서 NT 패스워드 변경) Web



참조: http://msdn.microsoft.com/en-us/library/ms954412.aspx

입력폼

Listing 1: ChangePasswordEntry.asp

NONEXECUTABLE
<%@ Language=VBS-ript %>
<S-RIPT id=DebugDirectives runat=server language=javas-ript>
</SCRIPT>
<HTML>
<HEAD>
</HEAD>
<BODY>
<H1 align=center>User&nbsp;Password&nbsp;Maintenance</H1>
<P>&nbsp;</P>
<P>Please enter your user name and New password below:</P>
<P>
<FORM action="ChangePassword1.asp" method=post id=frmLogin name=frmLogin>

<TABLE border=0 cellPadding=1 cellSpacing=1 width="75%">
 
  <TR>
    <TD>User Name</TD>
    <TD><INPUT id=txtUserName name=txtUserName
      style="HEIGHT: 25px; WIDTH: 365px">
</TD></TR>
  <TR>
    <TD>  Existing  Password</TD>
    <TD><INPUT id=txtPassword name=txtPassword
      type=password style="LEFT: 1px; TOP: 3px">
</TD></TR>
  <TR>
    <TD>  New Password  </TD>
    <TD><INPUT id=txtNewPassword name=txtNewPassword
      type=password>
</TD></TR></TABLE></P>
<P><INPUT type="submit" value="Submit" id=submit1 name=submit1>&nbsp;
</P></FORM>
<P>&nbsp;</P>

</BODY>
</HTML>

패스워드 변경 처리

Listing 2: ChangePassword1.asp

NONEXECUTABLE

<%@ Language=VBS-ript %>
<%

'CALLOUT A
dim sUser, sPassword
dim oUser, sConnectString
'END CALLOUT A

'CALLOUT B
sUser = request("txtUserName")
sPassword = request("txtPassword")
sNewPassword = request("txtNewPassword")
if sUser = "" then Response.Redirect "ChangePasswordEntry.asp"
'END CALLOUT B

Response.Write "User name is: " & sUser & "  --  " & sPassword & "<br>"

Response.Write "New Password is: " & sNewPassword & "<br>"

'CALLOUT C
sConnectString = "WinNT://bigboat/" & sUser & ",user"
Response.Write "Connect string: " & sConnectString & "<br>"

Set oUser = GetObject(sConnectString)
'END CALLOUT C

Response.Write "Logon user: " & Request.ServerVariables("LOGON_USER") & "<br>"
Response.Write "User Password: " & Request.ServerVariables("AUTH_PASSWORD") & "<br>"

'CALLOUT D
oUser.ChangePassword sPassword, sNewPassword
'END CALLOUT D

set oUser = Nothing

%>

----------------------------------------------------------------------------------------------
AD의 경우 ChangePassword1.asp의 sConnectString을 아래와 같이 변경
sConnectString = "LDAP://CN=" &  sUser & ",OU=users, " &  "DC=mycompany, DC=Com"
NT의 경우 ChangePassword1.asp의 sConnectString을 아래와 같이 변경
sConnectString = "WinNT://" &  "MyDomain/" & sUser & ",user"

덧글

댓글 입력 영역


접속정보

통계 위젯 (화이트)

01
19
56791

이 이글루를 링크한 사람 (화이트)

3