Hi, I'm trying to set-up a page where a user can change their NT password
thru ASP.NET and C#. But I can't get it to run without generating
an "System.Runtime.InteropServices.COMException: Unspecified error" error.
It seems that the Invoke method is generating the error. However, when I
debug I find in the Locals window that the properties associated with
DirEntry also report this error, even before the Invoke is attempted.
Which leads me to believe there is a problem with the initialisation of
DirEntry.
The basics of the source are;
using System;
using System.DirectoryServices;
namespace WebApp1
{
public class WebForm1 : System.Web.UI.Page
{
public static string currentUser;
public static void ChangePass()
{
DirectoryEntry DirEntry;
DirEntry = new DirectoryEntry(currentUser);
Object oPassword = new Object[] {"NewPassword05"};
DirEntry.Invoke("SetPassword", oPassword);
DirEntry.CommitChanges();
}
private void Page_Load(object sender, System.EventArgs e)
{
currentUser = Request.ServerVariables["AUTH_USER"];
// Put user code to initialize the page here
}
private void Button1_Click(object sender, System.EventArgs
e)
{
ChangePass();
}
}
}
Any help would be much appreciated!