
20/06/2006, 05:30
|
 | | | Fecha de Ingreso: julio-2005
Mensajes: 54
Antigüedad: 19 años, 7 meses Puntos: 0 | |
error al crear usuario en el Directorio Activo hola chi@s,
tengo un pequeño problema estoy tr5atando de crear un usuario en un Active Directory y me devuelve el error:
Código:
System.NullReferenceException was unhandled
Message="Referencia a objeto no establecida como instancia de un objeto."
Source="System.DirectoryServices"
StackTrace:
en System.DirectoryServices.DirectoryEntry.CommitChanges()
en ANSI_lib.User.Manager.insertUser(String rutaLDAP, String name, String schemaClassName, Hashtable properties) en C:\Documents and Settings\mlillo\Mis documentos\Visual Studio 2005\Projects\ANSI_lib\ANSI_lib\User\Manager.cs:línea 109
en winPrueba.Form1.btnInsertUser_Click(Object sender, EventArgs e) en C:\Documents and Settings\mlillo\Mis documentos\Visual Studio 2005\Projects\ANSI_lib\winPrueba\Form1.cs:línea 60
en System.Windows.Forms.Control.OnClick(EventArgs e)
en System.Windows.Forms.Button.OnClick(EventArgs e)
en System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
en System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
en System.Windows.Forms.Control.WndProc(Message& m)
en System.Windows.Forms.ButtonBase.WndProc(Message& m)
en System.Windows.Forms.Button.WndProc(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
en System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
en System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
en System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
en System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.Run(Form mainForm)
en winPrueba.Program.Main() en C:\Documents and Settings\mlillo\Mis documentos\Visual Studio 2005\Projects\ANSI_lib\winPrueba\Program.cs:línea 17
en System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
en Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
en System.Threading.ThreadHelper.ThreadStart_Context(Object state)
en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
en System.Threading.ThreadHelper.ThreadStart()
Y esta es la funcion que estoy utilizando alguien sabe decirme que esta pasando aqui....
Código:
public bool insertUser(string rutaLDAP, string name, string schemaClassName)
{
bool ret = false;
string domain = "e-fti";
using (DirectoryEntry de = new DirectoryEntry("LDAP://"+ domain +"/" + rutaLDAP))
{
DirectoryEntry usr = de.Children.Add("CN=New User", schemaClassName);
// Set the samAccountName, then commit changes to the directory.
usr.Properties["samAccountName"].Value = name;
usr.Password = "!0000pepe";
usr.CommitChanges();
ret = true;
}
return ret;
}
gracias de por todo
__________________ Salu2 :pensando: |