c# - Using a webservice with vbscript - "An operations error occurred." -
i've been fiddling bit c# webservices , vbscript. things work fine if trigger services manually through ie directly on webserver, when try run same service vbscript throws "an operations error occurred." exception.
the service pretty simple, create computer object in active directory.
directoryentry container = new directoryentry("ldap://ldapgw/" + ldaplocation); directoryentries computerou = container.children; directoryentry computerobject = computerou.add("cn=" + computername, "computer"); computerobject.invokeset("samaccountname", computername); computerobject.invokeset("description", "reserved"); computerobject.invokeset("useraccountcontrol", 4128); computerobject.commitchanges();
it's triggered way:
set soap = createobject("msxml2.xmlhttp")
soap "post", url, false, username, password
soap.setrequestheader "content-type", "text/xml; charset=utf-8" soap.setrequestheader "soapaction", nsurl + service
soap.send xml
i'm guessing has permissions, can't figure out what. i'm using impersonation , if output windowsidentity.getcurrent()
seems running correct user has needed rights in ad.
does know i'm doing wrong?
try keeping code inside block
using hostingenvironment.impersonate() ....you code.... end using
this impersonate account apppool when authenticating ad. if app pool identity has right access ad, work usual.
Comments
Post a Comment