| Ralf Ziller 2004-06-28, 8:55 am |
| "Dodo" <dodo@no.fly> schrieb im Newsbeitrag
news:eAj41gPXEHA.3168@TK2MSFTNGP10.phx.gbl...
> anyone have any ides for members of the pop3 users group being able to
> change their own passwords?
There is no mechanism implemented for this in the POP3 protocol. You could
create a Asp(x) page that can do this.
Here's some code in c# you could use inside an aspx:
// get the DirectoryEntry for the User
DirectoryEntry entry = new DirectoryEntry(@"WinNT://<domain>/"+UserName);
//Passwords are passed in an Array containing the old and new password
object[] oPassword = new object[2];
// fill Array with Passwords obtained from Textboxes.
oPassword[0] = oldPass.Text;
oPassword[1] = newPass1.Text;
try
{
// Invoke the ChangePassword function for the user
entry.Invoke("ChangePassword", oPassword);
}
catch (System.Reflection.TargetInvocationException TIE)
{
System.Runtime.InteropServices.COMException ce =
(System.Runtime.InteropServices.COMException) TIE.InnerException;
if(ce.ErrorCode==-2147024810)
{// old Password does not match; inform the user...}
else
{
// other error... throw it up the stack
throw(ce);
}
}
finally
{
// close the DirectoryEntry
entry.Close();
}
|