Change expired password in AD with C# (使用c# 更改AD 中过期密码)
来源:互联网 发布:java bigdecimal 除法 编辑:程序博客网 时间:2024/05/20 04:14
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
- Change expired password in AD with C# (使用c# 更改AD 中过期密码)
- mysql5.7密码过期ERROR 1862 (HY000): Your password has expired. To log in you must change
- C# 使用AD(Active Directory)验证内网用户名密码
- Oracle密码过期the password has expired
- Oracle the password has expired -密码过期
- Oracle密码过期the password has expired
- Oracle密码过期the password has expired
- Oracle密码过期the password has expired
- Oracle密码过期the password has expired
- Oracle密码过期the password has expired
- Oracle密码过期the password has expired
- C#连接AD
- C# 读写AD数据
- C#获取AD用户信息
- C#获取AD用户信息
- C# 操作 AD
- C# 获取AD用户信息
- C# 操作 AD
- .net中C#代码与javaScript函数的相互调用问题。
- 【编程游戏】贺岁放礼花。(点燃续帖2-141楼sharp_ice的焰火)
- 知识积累 成就人生
- Graphics Device Interface:图形设备接口
- 选好自己的方向
- Change expired password in AD with C# (使用c# 更改AD 中过期密码)
- 範例檔案下載修復
- 屏蔽线的四种接法
- 贡献一个PostgreSQL的备份脚本(原创)
- IRQ设置
- 【编程游戏】贺岁放礼花。(点燃续帖2-142楼sharp_ice的焰火)
- Javascript 获得网页控件方法大全(附全码)
- ORACLE 中ROWNUM用法总结
- CSDN个人空间相册功能暂停公告