Link to home
Start Free TrialLog in
Avatar of cconway22
cconway22

asked on

ADSI Problem

Hello friends,
I'm having a problem using ADSI to change a password for a user in Active Directory from an ASP page. All users of the website must log in to the website (we use NT authentication, therefore there is an entry in Active Directory for each user). The web farm including the domain controller is behind a firewall and is separate from the domain that the users reside in. Also, I don't know if it makes a difference or not but the users are using NT4 workstations. I've written a component in VB to do this and here's the code:

Public Function ChangePassword(Username As Variant, Domain As Variant, _
            OldPass As Variant, NewPass As Variant) As Variant
   
    Dim o As IADsOpenDSObject
    Dim usr As IADsUser
   
    On Error GoTo ChangePasswordError
   
    Set o = GetObject("WinNT:")

    Set usr = o.OpenDSObject("WinNT://" & Domain & "/" & Username, Username, OldPass, 1)
    usr.ChangePassword OldPass, NewPass
    ChangePassword = "Ok"
    Exit Function
   
ChangePasswordError:
    ChangePassword = "Error: " & Err.Number & " " & Err.Description
   
End Function

Here's the code for the page I am testing this component with:
<!-- TestADSI.html -->
<%
     
     Dim objADSI, strMsg
     Set objADSI = Server.CreateObject("ADSIUtils.Class")
     
     'user=testuser
     'domain=coras
     'old password=Password123!
     'new password=Password456!
     strMsg = objADSI.ChangePassword("testuser","coras","Password123!","Password456!")
     
     Response.Write strMsg
     
     Set objADSI = Nothing
     
%>


When I call the page, I get the following error:
Error: -2147024843 Automation error The network path was not found.

The error occurs on the Set usr = .... line but I can't find any documentation on how to solve this problem. Any help would be so greatly appreciated!!!
Avatar of thunderchicken
thunderchicken

Did you register your component as an Administrator?

Dear cconway22,

Check the permissions. Did all the users can access this component or not. secondly try from both logins i mean with administrator and a normal user login.

Regards
Shirjeel.
Avatar of cconway22

ASKER

I have compiled the component as an administrator and the permissions are fine. Even when I login as myself (a member of administrators) I get the error.
did you register in MTS as an administrator?
yes, it is registered in COM+ in an application that specifies to use the Administrator account but i still get the error.
Dear cconway22,

Did u checked it b4 deploy. is it working fine? i think u should check its functionality once more. may be there is any problem within its programming

Regards,
Shirjeel.
When I put the function into an executable, it works fine. Even when I call the function as a dll in a separate executable, it runs fine. The problem only occurs when I call the function from an asp page.
It appears this question has been abandoned.

I will leave a recommendation in the Cleanup topic area that this question will be:

- Question PAQ'd & Points refunded -

Please leave any comments here within the next seven days.

DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Wakie,
EE Cleanup Volunteer.
ASKER CERTIFIED SOLUTION
Avatar of YensidMod
YensidMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial