Change User Password via ADSI & ASP

Change User Password via ADSI & ASP

Post by Steve Topilnyck » Sat, 11 May 2002 07:22:26



I am running NT 4.0 SP6 all Hot Fixes and the ADSI 2.5 Extensions.  From
a secure web page, I am attempting to allow my logged on users to change
their passwords, but the code keeps coming back with error '80005000'.
Looking the the help file it states that the Path is not found..  It is
the correct path, Pegasus is the Computer. (Note: the > is to prevent
word wrapping):

Quote:> set usr = GetObject("WinNT://Pegasus/" & Request.ServerVariables("logon_USER") & ", user"
>  call usr.ChangePassword(strOldPass, strNewPass)

Can anyone give a hint to why this is failing, or is there additional
steps necessary to complete this task?

--

Regards,

Steve Topilnycky            
Top Cat Computing
Web:  http://www.topcatcomputing.com/

 
 
 

Change User Password via ADSI & ASP

Post by Bob Waggone » Sun, 12 May 2002 05:32:55


Steve,

It's probably because ADSI wants the account in domain/username format
and Request.ServerVariables("LOGON_USER") is giving you the account
in domain\username format.
Try:

Quote:> set usr = GetObject("WinNT://Pegasus/" &

Replace(Request.ServerVariables("LOGON_USER"),"\","/") & ", user")

Bob


Quote:

> I am running NT 4.0 SP6 all Hot Fixes and the ADSI 2.5 Extensions.  From
> a secure web page, I am attempting to allow my logged on users to change
> their passwords, but the code keeps coming back with error '80005000'.
> Looking the the help file it states that the Path is not found..  It is
> the correct path, Pegasus is the Computer. (Note: the > is to prevent
> word wrapping):

> > set usr = GetObject("WinNT://Pegasus/" &

Request.ServerVariables("logon_USER") & ", user"
Quote:> >  call usr.ChangePassword(strOldPass, strNewPass)

> Can anyone give a hint to why this is failing, or is there additional
> steps necessary to complete this task?

> --

> Regards,

> Steve Topilnycky
> Top Cat Computing
> Web:  http://www.topcatcomputing.com/


 
 
 

Change User Password via ADSI & ASP

Post by Steve Topilnyck » Mon, 13 May 2002 15:38:22



Quote:> Try:
> > set usr = GetObject("WinNT://Pegasus/" &
> Replace(Request.ServerVariables("LOGON_USER"),"\","/") & ", user")

Thanks Bob, I will give it a try.
--
Regards,

Steve Topilnycky            
Top Cat Computing
http://www.topcatcomputing.com/      

 
 
 

Change User Password via ADSI & ASP

Post by Steve Topilnyck » Tue, 14 May 2002 07:20:17



Quote:> Try:
> > set usr = GetObject("WinNT://Pegasus/" &
> Replace(Request.ServerVariables("LOGON_USER"),"\","/") & ", user")

Bob,
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
else
' 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
User.SetInfo
Set User = Nothing
Response.Write "Password Changed"
End if

--

Regards,

Steve Topilnycky            
Top Cat Computing
Web:  http://www.topcatcomputing.com/

 
 
 

Change User Password via ADSI & ASP

Post by Bob Waggone » Thu, 16 May 2002 01:10:31


Steve,
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
actually
typed in the authentication box so if a user doesn't type in a local machine
name
prefix then all it will contain is the username. So  your code needs to be
able
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.

Bob



> > Try:
> > > set usr = GetObject("WinNT://Pegasus/" &
> > Replace(Request.ServerVariables("LOGON_USER"),"\","/") & ", user")

> Bob,
> 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
> else
> ' 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
> User.SetInfo
> Set User = Nothing
> Response.Write "Password Changed"
> End if

> --

> Regards,

> Steve Topilnycky
> Top Cat Computing
> Web:  http://www.topcatcomputing.com/

 
 
 

Change User Password via ADSI & ASP

Post by Steve Topilnyck » Thu, 16 May 2002 22:10:28



Quote:> 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.

Funny, in testing, after posting my message, I got the above message,
but the password was in fact changed.  I don't recall any specific
password policies on that particular machine (just the PDC), but I will
have to double check if I set a policy or not.
Is there a way to trap the response of the password change, and return
the appropriate response, i.e. successful, error..what ever..

Again, thanks for all your help.
--

Regards,

Steve Topilnycky            
Top Cat Computing
Web:  http://www.topcatcomputing.com/

 
 
 

1. Enabling users to change their password via web page (ASP/ADSI)

Hi, I've seen many discussions on this subject but no solutions. I've
been trying to connect the users current user object using
opendsobject. Unfortunately, it seems to ingore using this account and
use the IIS web user account instead which will not have rights to
change users passwords.

If anyone has a working solution for this I would LOVE to see it. I've
been bashing my head against a brick wall for a couple of days now!

Thanks
Chris

2. SMS Package install file not created

3. Changing User Passwords with ADSI & ASP

4. Hardware firewall:ISA necessary/CAL question

5. How can I change a user's ActiveDirectoryWin2000 properties via ASP using ADSI?

6. RPG Record Lock Problem

7. Error changing password using ASP & ADSI

8. OULOOK EXPRESS FOR WINDOWS 95'

9. Can't access AD via LDAP & ADSI from ASP.NET (VB) page

10. ASP/ADSI Page to Change passwords

11. ASP/ADSI change password in AD

12. Validating Users via ASP/VB ADSI

13. create user w/ ADSI via ASP