Wrox Programmer Forums
|
Classic ASP Components Discussions specific to components in ASP 3.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 5th, 2003, 06:15 AM
Registered User
 
Join Date: Jul 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default SetPassword

Hi,

I'm trying to create a new user in windows 2000 server. It's a domain controller with ADSI.

My code looks like:

Set dso = GetObject("LDAP:")
Set obj1 = dso.OpenDSObject("LDAP://OU=Web,DC=xavigonzalvo,DC=ods,DC=org", _
"[email protected]", "pwd", ADS_SECURE_AUTHENTICATION)

Set usr = obj1.Create("user", "CN=newuser")
usr.Put "sAMAccountName", "newuser"
usr.SetInfo

usr.SetPassword "newuser_pwd"
usr.AccountDisabled = False
usr.SetInfo

And I get an error like:

Access denied

I can create the user but when I include the SetPassword instruction I get this error.

Any help? Thanks a lot

 
Old November 22nd, 2004, 01:45 PM
Registered User
 
Join Date: Nov 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi xavigonzalvo,

I have included a possible solution below in C#, which does not use the SetPassword method but achieves the same result without the sleepless nights :). But in order for it to work you need to verify the following:
a) That SSL is enabled on the Active Directory Server and the ASP.NET Application server that you are using. You can check out the following link to enable SSL on your AD server: http://support.microsoft.com/default...-us;247078#kb2. If the app is on a different server than the AD server then you will have to export the root certificate (automatically installed on setting up) from Certificate Server on the AD and import it to the Trusted Root Certificates Store on your app server. You can do this via Tools - Internet Options - Content - Certificates.
b) To test that SSL is enabled, you can run the lpd.exe Windows 2000 Support Tools from the command prompt. Then connect to your DC via port 636. If you can bind using your admin or some other credentials, then SSL is enabled.

.................................................. ..................

DirectoryEntry usr = new DirectoryEntry(YOUR_LDAP_STRING); //your ldap string must connect to port 636 for SS

usr.AuthenticationType = AuthenticationTypes.SecureSocketsLayer;
string quotePwd;
byte[] pwdBin;

quotePwd = String.Format(@"""{0}""", password);

pwdBin = System.Text.Encoding.Unicode.GetBytes(quotePwd);

usr.Properties["unicodePwd"].Add(pwdBin);

usr.CommitChanges();

.................................................. ..................

Let me know if this was helpful to you.

John Mencias ([email protected])











Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.