I might have given you bad info the last time.....
If you are using Basic Authentication then it's possible to logon with
only a username and password if you are logging into the default domain.
The "default domain" is the web server machine name unless you have
changed the IIS basic authentication settings to have another domain be the
default. Request.ServerVariables("LOGON_USER") contains what the user
typed in the authentication box so if a user doesn't type in a local machine
prefix then all it will contain is the username. So your code needs to be
to handle whichever way the user logs in.
If the user logs in with Pegasus\username then use this:
Set usr = GetObject("WinNT://" &
Replace(Request.ServerVariables("LOGON_USER"), "\","/") & ", user")
But if the user logs in using only his username, then use this:
Set usr = GetObject("WinNT://Pegasus/" &
Request.ServerVariables("LOGON_USER) & ",user")
Then usr.ChangePassword(oldpass, newpass) should work fine.
error '80070056' is what you get when the old password is incorrect. You'll
also need to handle
errors when the new password doesn't meet policy requirements (complexity,
length, history, aging, etc.
> > Try:
> > > set usr = GetObject("WinNT://Pegasus/" &
> > Replace(Request.ServerVariables("LOGON_USER"),"\","/") & ", user")
> Thanks for the tip, Now I get:
> error '80070056'
> The specified network password is not correct.
> It is correct, because I use HTTP Authentication to log in to this area.
> I pull the Users ID from the Request.ServerVariables("LOGON_USER"). I
> know that the password is correct. Maybe a little background on the
> setup will help.
> I got 2 server. 1 is the PDC and the other is a member server. The
> member server is the Web Server. The User accounts that I want to
> change the passwords on is the Member server, they are not part of the
> domain, just that server.
> BTW, Request.ServerVariables("LOGON_USER") just returns the user name,
> no other slashes or domain/computer name. IIS is configured for Plain
> Text authentication.
> Do you have any more suggestions:
> Dim strOldPass,strNewPass,strConPass
> Dim ERRCODE, bErr, icount
> Dim Usr 'As IADsUser
> bErr = not True
> ' ...error checking code
> if bErr =True then
> response.redirect "changepass.asp?ERRCODE=" & ERRCODE
> ' Debug statement:
> Response.Write "User: " & Request.ServerVariables("logon_USER") & "<br>"
> Set User = GetObject("WinNT://viper/" & Replace(Request.ServerVariables
> ("logon_USER"),"\","/") & ",user")
> User.ChangePassword strOldPass, strNewPass
> Set User = Nothing
> Response.Write "Password Changed"
> End if
> Steve Topilnycky
> Top Cat Computing
> Web: http://www.topcatcomputing.com/