473,668 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ADSI - Trying to enable a User after it is added (User addition wo

Hi,

I have written an ASP.NET 2.0 application that uses Active Directory or ADAM
to manage account users - the site has a page that allows people to create an
account (much like any site). The page populates the AD with all the
information and the user account but I am unable to enable the account.
Microsoft has information on how to do that here -->
http://msdn.microsoft.com/library/de...ing_a_user.asp
(the sample is for Visual Basic) - and I am unable to complete the bottom
portion of the script. Can some one point me in the right direction - or can
you tell me how I can add a snippet of VBscript code to an ASP.NET page.

I am using the Active DS Type library - not sure why there are multiple ones
(System.Directo ryServices) but it is rather confusing - I seem to accomplish
one thing with one and another with the other (they did have trouble
co-existing however). Anyway my script works very well but I am not able to
access the properties required to enable the account.

Here is a simple version (no error checking) of the code
Sub BTSub_Click(ByV al sender As Object, ByVal e As EventArgs)
Dim objUsers As ActiveDs.IADsCo ntainer
Dim objNewUser As ActiveDs.IADsUs er
objUsers = GetObject("LDAP ://OU=Pickupfootba ll,DC=systemfix ,DC=ca")
objNewUser = objUsers.Create ("user", "CN=" & txtFName.Text &
txtLName.Text)
objNewUser.Put( "sAMAccountName ", txtFName.Text & txtLName.Text)
objNewUser.Put( "givenName" , txtFName.Text)
objNewUser.Put( "sn", txtLName.Text)
objNewUser.Put( "streetAddress" , txtEADDR.Text)
objNewUser.Put( "mail", txtEADDR.Text)
objNewUser.Put( "title", txtOCC.Text)
objNewUser.Put( "displayNam e", txtFName.Text & "." & txtLName.Text)
objNewUser.Put( "descriptio n", GNDList.Text & ";" & txtAge.Text)
objNewUser.SetI nfo()
objNewUser.Chan gePassword("", "j1r1mi1")

End Sub
Thanks
Jeremie Legault
jl******@system fix.ca
Nov 23 '05 #1
1 2347
This has been solved

"Jeremie Legault" wrote:
Hi,

I have written an ASP.NET 2.0 application that uses Active Directory or ADAM
to manage account users - the site has a page that allows people to create an
account (much like any site). The page populates the AD with all the
information and the user account but I am unable to enable the account.
Microsoft has information on how to do that here -->
http://msdn.microsoft.com/library/de...ing_a_user.asp
(the sample is for Visual Basic) - and I am unable to complete the bottom
portion of the script. Can some one point me in the right direction - or can
you tell me how I can add a snippet of VBscript code to an ASP.NET page.

I am using the Active DS Type library - not sure why there are multiple ones
(System.Directo ryServices) but it is rather confusing - I seem to accomplish
one thing with one and another with the other (they did have trouble
co-existing however). Anyway my script works very well but I am not able to
access the properties required to enable the account.

Here is a simple version (no error checking) of the code
Sub BTSub_Click(ByV al sender As Object, ByVal e As EventArgs)
Dim objUsers As ActiveDs.IADsCo ntainer
Dim objNewUser As ActiveDs.IADsUs er
objUsers = GetObject("LDAP ://OU=Pickupfootba ll,DC=systemfix ,DC=ca")
objNewUser = objUsers.Create ("user", "CN=" & txtFName.Text &
txtLName.Text)
objNewUser.Put( "sAMAccountName ", txtFName.Text & txtLName.Text)
objNewUser.Put( "givenName" , txtFName.Text)
objNewUser.Put( "sn", txtLName.Text)
objNewUser.Put( "streetAddress" , txtEADDR.Text)
objNewUser.Put( "mail", txtEADDR.Text)
objNewUser.Put( "title", txtOCC.Text)
objNewUser.Put( "displayNam e", txtFName.Text & "." & txtLName.Text)
objNewUser.Put( "descriptio n", GNDList.Text & ";" & txtAge.Text)
objNewUser.SetI nfo()
objNewUser.Chan gePassword("", "j1r1mi1")

End Sub
Thanks
Jeremie Legault
jl******@system fix.ca

Nov 24 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4420
by: Miguel Orrego | last post by:
Hi, I have found some code that authenticates users agains a domain using ADSI. I then redirect to another page and pass the username they have entered as a string. However, it would be nice to also get their full name from Active Directory once authenticated. Can anyone suggest how I may modify this code to achieve this? I would also like to pass their full name to the next page as a string. The code I found: <%
4
7370
by: Akhlaq Khan | last post by:
we are developing an intranet application (web based) which needs to detect the logged in user ID of the user hitting the website. the intranet is huge and based on win2k active directory (around 20-30 different domains) with 25K+ users. i dont want to use "NT challenge response" for this pupose. I am exploring ways using ADSI and WMI to query the Active directory by using the IP address in the incoming web request and trying to figure...
2
4077
by: Christopher Johannsen | last post by:
Good Day: I am working on building a tool Using ASP/COM & IIS5.1 for a non-administrative technical support team to change domain passwords for users. I have the basic interface built and working from my developement machine (Windows XP Pro SP 1A) which is hosting the pages for now. The problem is that when I try to access the site from a browser on a different pc using my credentials (IIS is running in Windows Authentication), it...
14
5220
by: Arran Pearce | last post by:
Hi, I am looking for a way to use System.DirectoryServices to find all users on a domain whos accounts are either locked out or disabled. I have used ADSIEdit and the mmc schema add-in to try and find properties for these things but have not had any luck so far. Also i did a search on the Platform SDK doc's. It has examples in VB and C++ but these are not using DotNet and dont give any hint to a property that may be used. They seem...
5
2637
by: Rubble | last post by:
Hello, Im trying to see if a user exists in active directory. The code I have has been posted elsewhere and apparantly works for others....but it will not work for me. I get the error: "The specified domain either does not exist or could not be contacted." Can anyone please help me? Im completely lost here. Here is the code (roughly the same code works when I create it in vbs): string LDAPPath =...
0
1151
by: rias | last post by:
I'm new to VB.NET and ADSI. By default it appears the adsi limits objects returned to 1000 items. I've seen web references that say that the limit is imposed by unpaged queries. I added an explicit pagesize statement, and the findall.count value went up from 1000 to 4000+ for the OU that I'm querying. (with considerable added delay in response). However when I try to iterate through a for-each loop, I still seem to get only 1000 items. ...
0
1521
by: Jeremie Legault | last post by:
Hi, I have written an ASP.NET 2.0 application that uses Active Directory or ADAM to manage account users - the site has a page that allows people to create an account (much like any site). The page populates the AD with all the information and the user account but I am unable to enable the account. Microsoft has information on how to do that here -->...
3
2236
by: chat_devil | last post by:
hi, does anyone know if it is possible to remove an attribute that can not be read into the ADSI property cache/collection. i'm trying to do an eDirectory password change from .net directory services. eDirectory uses the "userPassword" property to change the password and for a normal user, this has to be deleted and then added to in one LDAP modify operation to successfully change the password. As far as i know eDirectory schema does...
8
3124
by: John | last post by:
Hi, gurus, How can I implement the following feature in C#: Set objGroup = GetObject("WinNT://" & strComputer & "/" & strGroup & ", group") For Each objMember In objGroup.Members WScript.Echo vbCrLf & " Name: " & objMember.Name Next
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8890
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8791
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7398
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4376
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2786
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2018
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.