SEARCH YOUR SOLUTION HERE  

Active Directory password reset in asp.net


I have a web page through this page when I try to add a new user then users created successfully but when try resetting their password then I am getting errors

add New user successfully

public static void AddUser(ADUser adUser)
{
// Local variables
DirectoryEntry oDE = null;
DirectoryEntry oDENewUser = null;
DirectoryEntries oDEs = null;

try
{
oDE = GetDirectoryEntry(GetADPath(PROD, adUser.UserType));

// 1. Create user account
oDEs = oDE.Children;
oDENewUser = oDEs.Add("CN=" + adUser.UserName, "user");

// 2. Set properties
SetProperty(oDENewUser, "givenName", adUser.FirstName);
SetProperty(oDENewUser, "sn", adUser.LastName);
SetProperty(oDENewUser, "mail", adUser.Email);
SetProperty(oDENewUser, "sAMAccountName", adUser.UserName);
oDENewUser.CommitChanges();

/// 4. Enable account
EnableAccount(oDENewUser);

// 3. Set password
//SetPassword(oDENewUser, adUser.Password);
SetPassword1(oDENewUser.Path, adUser.Password);
oDENewUser.CommitChanges();

oDENewUser.Close();
oDE.Close();
}
catch (Exception ex)
{
throw ex;
}
}
I have try the following 2 SetPassword methods but getting error.
Method 1.
internal static void SetPassword1(string path, string userPassword)
{
//Local variables
DirectoryEntry usr = null;

try
{
usr = new DirectoryEntry();
usr.Path = path;
usr.AuthenticationType = AuthenticationTypes.Secure;
object ret = usr.Invoke("SetPassword", userPassword);
usr.CommitChanges();
usr.Close();
}
catch (Exception ex)
{
throw ex;
}
}
The exception raised (Error Code 80072035: The server is unwilling to process the request)
Method 2.
internal static void SetPassword(DirectoryEntry de, string userPassword)
{
//Local variables
//DirectoryEntry usr = null;
string quotePwd;
byte[] pwdBin;

try
{
quotePwd = String.Format(@"""{0}""", userPassword);
pwdBin = System.Text.Encoding.Unicode.GetBytes(quotePwd);
de.Properties["unicodePwd"].Value = pwdBin;
de.CommitChanges();
//usr.Close();
}
catch (Exception ex)
{
throw ex;
}
}
The exception raised ("Exception has been thrown by the target of an invocation.")
Is there an easy way to tell if there is a problem with changing a password
Please reply me as soon as possible.

Posted On: Tuesday 27th of November 2012 03:33:36 AM Total Views:  154
View Complete with Replies




Related Messages:

How to create an interactive coordinate grid plane   (92 Views)
I am trying to make some sort of map, where users can select a coordinate on it, and get certain information about it. (it's for a game). Is there anyway to do this in vb.net/asp.net
[2005] Creating Interactive Online Demo   (115 Views)
Everyone, I am currently building a new website for my company and I would like to include an online demo of our main application. The application itself controls a SQL database in the background. I know I could create a flash demo and just play the movie online but I would like it to be as interactive as possible. I would also like to stay away from people downloading and installing a trial version. Basically what I have in mind is to have both the application and the background DB run on the webserver. Does anyone know the best way to do this The application itself is built for the windows platform not IE or the like. Could I just import some of the forms from my application into my website Or would I need to change all the buttons to server-side controls I have tried searching the forums and google to see if there are any tutorials but I couldn't find any. Any guidance would be appreciated.
Interactive,clickable seating chart   (182 Views)
Maybe someone can help me see if this can be done in vb.net. I am building a ticketing software for a proforming arts center and i want to have a seating chart that i can click on sections and it take me to a bigger view of that section and lets me choose seat and store them somehow so i can move them to the shopping cart. please help
How to add vb6 activex component into...   (97 Views)
im creating a activex component in vb6.0 which sends tasks. I want to utilize this activex control on an ASP.net web page... Lets say I ve created the ocx (compiled it) and what not..and I go into Visual Studio.net...I create a new project..I have webform1.aspx...I want to add this user control activex from vb6.0 to this page...what files do I need to "add". How do I add this user control. Also after adding it how do I call a property or method of it... I have been trying to do this with some problems. I cannot seem to figure out how to physically add this active x component into vs.net. Anyone with some info please (Posting this in vb.net and asp.net since they are all related)
how to retrieve active directory objects   (111 Views)
I want to develop an application in which I can use active directory objects. How can I retrieve user name, password and Domain from the active directory I want to log on my software using the active directory user name and password. I am using .NET 2003 and framework 1.1 . Thanking you, Zahir
Re: [05] Client-side Interactive server controls   (134 Views)
How is interactivity generally implemented in ASP.NET server controls Are manual AJAX-style techniques used like in PHP or does ASP.NET have any built in methods to facilitate this Cheers, mmkay - P
Re: Newbie Advice: UserInteractive mode   (180 Views)
Hi , I am new to ASP.NET making the move over from windows forms development. In Windows forms I used to throw an error to a windows form or a message box when I wanted to alert the user about something i.e. invalid password on login. I would like to know if it is better to place the application into "UserInteractive mode" and use standard dialog boxes or should i be creating pages to report such things. Any applications I produce will be restricted to the local Intranet. Any advice appreciated.
Re: setactiveview refreshes the page   (124 Views)
I have 1 multiview and 2 views in it, then I have 2 link buttons, every time I clicked on a link button, it refreshes the page. I don't want it to refresh the page. I want the views to be updated accordingly without the page is being refreshed. How to do that
signing an activex control   (109 Views)
Created an activex control to send outlook tasks from an asp.net web page. I noticed when the active x component gets initialized on the page I get that IE message, about whether to accept the activex or not (part of the security). I think you can modify the IE options to drop this message.... BUT I do not want to do that, so I read more and read that you can sign an active x component. This activex component was written in VB6. The page is asp.net / vb.net. This activex sits on this page. How do I sign this activex component so that our current staff does not receive this message
UserInteractive mode (How to)   (135 Views)
When runnin my fisrt web application (from an example from a text book) I get the following error: --- It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application. --- The modal dialog in question is a MsgBox(). How do I run the application in UserInteractive mode I've been told to use the JavaScript alert() function instead, but I would like to know if it really has to be so. Tkx!
Get value from active x to textbox in webform.   (219 Views)
drydo Littlethorpe, Leicestershire Since 9/2/2002 Posts 8,852 Reputation 59,225 Reply drydo (drydo) replied on 9/5/2008 2:22 AM rated by 0 users OK - I zero experience of creating a custom ActiveX control, but...By creating a property in your control, the IComInterface should allow you to expose that properties to the client-side code in your web page.And by client-side code, I mean Javascript. What Javascript does from that point, e.g. does it poll the ActiveX control checking the entry in order to write it across - that's pretty much up to you.
data dynamics active reports   (172 Views)
I heard another method of generating reports is using data dynamics Active reports.Since am a newbie to this can u tell me some good site that explains how to create sample application using Data dynamics active reports ....Am using Asp.net1.1using c#.very very urgent...Thanx in advance..Please explain in detail...
Mouseover Tips with active links   (134 Views)
hi there,I need to add a mouseover tip with active links to a Web control.(i.e) When I move the mouse over a text or any other control, a text with active links should appear on its side.How to do this
Interactive web with mail   (117 Views)
has anyone ever developed an interactive web application where forms are filled and passed from one person to another for approval My intended web application should have a requestor fill in an application and submits to management for approval. There would be several people involved in the approval so the application would go through a cycle. How the approver would know is a note with a link to let them know that there is an application awaiting their approval. The question now is, is it possible to get this done because I have never done something like this before but am intending to. ANy ideas or comments are welcome
setting the header in a datalist with repeatcolumns active   (294 Views)
Hi all. Here's what I'm trying to do: I'm generating a report using a datalist. Since each piece of info isn't big, I've set the RepeatColumns=3. So my data on the page looks like: Model1 Type1 Number1 Model3 Type3 Number3 Model5 Type5 Number5 Model2 Type2 Number2 Model4 Type4 Number4 Model6 Type6 Number6 In the HeaderTemplate, I can manually create a static header that has "Model Type Number" over each of the Columns but this has limitations (like if there are only 2 items in the dataset instead of 3 or more). Also, the static alignment is not what I really want. My question: Is there a way (maybe in the ItemCreated event where ListItemType = Footer) to dynamically set up the header so that each column gets a "Model Type Number" in alignment with the column
How to connect a activer server page to a desktop bluetooth applicatio   (163 Views)
I want to connect an active server page to a bluetooth application. Can anybody please help me out in this
Interactive Drop Down Menu   (114 Views)
I am trying to figure out how to add interactive drop down options to my site. I'm not sure what it would technically be called, maybe if I knew that I could do some more searching around for the answer so any help would be greatly appreciated. You can see an idea what I am wanting at http://myazdesign.com/dropdown.html the only difference is I want it to show a price based on what options are chosen. I'm not expecting anyone to give me the code but any ideas, or advice would be appreciated. (Such as what I might google to find the answer,
Interacting with active directory   (123 Views)
I have been given a new project which has introduced a lot of new subjects to me. I have to make a .net web page that will sit on our company local server, users will connect to it through a desktop icon. The page has no UI, it just needs to query AD to find out who the logged in uer is, pull their email address, and name. Then it will redirect them to a new URL. I can do the second part (redirect) but I have never had to query AD through ASP/C# before. I am looking for some online tutorials on how to do this, any suggestions
how can i use the fileSystemWatcher as activex ?   (249 Views)
I want to make a web application that countain activex to watch folder which the user select it's path from folderBrowserDialog . then make any action when any change done @ this folder .
.NET 2.0: Multiview - How to determine active view   (142 Views)
It seems that this should be easy, but I am stumped.Given:Code: [stuff] [stuff] [stuff] and also given some buttons (or other controls) that make calls such as:Code:mv.SetActiveView(V1)What must be done to determine the current active view The reason I ask is this: When certain views are not active, there is no reaosn to perform calculations on controls that are not visible. What I would like, ideally, is something like this:Code:Select Case mv.ActiveViewName Case "V1" Case "V2" Case "V3"End CaseCan you please suggest a means to achieve thisThank you.