How to change user password in a .NET application

  • Thread starter =?ISO-8859-1?Q?Yannick_B=E9ot?=
  • Start date
?

=?ISO-8859-1?Q?Yannick_B=E9ot?=

Hi,

I'm trying to make an application that allow a user, through a web form
to change its password

On a click event, here is the code

DirectoryEntry usr = new DirectoryEntry(
theUserDN,
user,
password, AuthenticationTypes.Secure);
usr.Invoke(
"ChangePassword",
new object[]{password, newpassword} );

where password is the current user password
newpassword... the new password
user, the login
theUserDn, something like
"LDAP://mydomaincontroller/CN=...,cn=users,DC=superheros,DC=com"


I have got an exception :

[COMException (0x8007202f): Une violation de contrainte s'est produite.]

[TargetInvocationException: Une exception a été levée par la cible d'un
appel.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[]
namedParameters) +473
System.Type.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args) +29
System.DirectoryServices.DirectoryEntry.Invoke(String methodName,
Object[] args) +107
clarins.u1_1.Button1_Click(Object sender, EventArgs e) +108
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277



Do you have any idea?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top