检查当前用户是否登陆
using System.Security.Principal;
this.Page.User.Identity.IsAuthenticated;
CHANGE PASSWORD:
string oldPsw , newPsw;
string userName = this.Page.User.Identity.Name;
userName = userName.Remove(0, userName.LastIndexOf('//') + 1);
DirectoryEntry user = new DirectoryEntry("WinNT://./" + userName);
oldPsw= txtOldpsd.Value;
newPsw= txtNewpsd.Value;
try
{
user.Invoke( "ChangePassword", new object[]{oldPsw, newPsw});
this.lblMessage.Text = "成功修改密码"
}
catch
{
this.lblMessage.Text = "修改密码失败"
};