Question:
Hello,
I'm looking for a solution to completely replace iisadmpwd with a pure ASP.NET 2.0 solution.
We are using windows authentication with a web application.
If the user's password is expired we need to enable him to change his old password via a web
interface. That can be a complete web application of it's own.
Iisadmpwd seems very outdated and the persons in charge of that particular project won't
accept this 'old-fashioned asp and vb thing' to do the job.
I found a solution to change a local computer account password here: http://forums.asp.net/t/379197.aspx
But this does not work if the account in question has a expired password. So that's not
a thing that is going to help.
I searched half a day here in the forums, on google, on codeplex, but I did not find a suitable solution.
Do you know a solution for this, that will work on local computer accounts as well as on domain accounts?
Regards,
Sebastian
Solution:
Hi,
Have you read this one?
http://directoryprogramming.net/forums/thread/5289.aspx
try this code:
DirectoryEntry dirEntry = (DirectoryEntry)usr.GetUnderlyingObject();
dirEntry.Properties["pwdLastSet"].Value = 0;
dirEntry.CommitChanges();
dirEntry.Properties["pwdLastSet"].Value = -1;
dirEntry.CommitChanges();
use this code to refresh expired password. then, change the password.
Hope it helps
Regards
Relative links:
http://forums.asp.net/p/1368570/2861644.aspx#2861644
http://forums.asp.net/t/379197.aspx
http://directoryprogramming.net/forums/thread/5289.aspx

本文提供了一个使用C#代码解决Active Directory(AD)中过期密码问题的方法。当用户密码过期时,通过一个独立的ASP.NET 2.0 Web应用程序允许用户更改密码。文中提到原有解决方案iisadmpwd已过时,并给出了能够更新本地及域账户过期密码的代码示例。
514

被折叠的 条评论
为什么被折叠?



