Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 以编程方式访问Windows密码策略设置_C#_Wmi_Wmi Query - Fatal编程技术网

C# 以编程方式访问Windows密码策略设置

C# 以编程方式访问Windows密码策略设置,c#,wmi,wmi-query,C#,Wmi,Wmi Query,我正在开发一个使用Windows身份验证的.NET网站 我有一个要求,使网站密码策略完全相同的Windows密码策略下是:(gpedit.msc) 计算机配置\ Windows设置\安全设置\帐户策略\密码策略 如何以编程方式在C#中访问这些Windows密码策略设置 PS我查看了Windows Management Instrumentation,但找不到指向Windows密码策略的正确路径 using System.Management; ManagementScope scope = ne

我正在开发一个使用Windows身份验证的.NET网站

我有一个要求,使网站密码策略完全相同的Windows密码策略下是:(gpedit.msc) 计算机配置\ Windows设置\安全设置\帐户策略\密码策略

如何以编程方式在C#中访问这些Windows密码策略设置

PS我查看了Windows Management Instrumentation,但找不到指向Windows密码策略的正确路径

using System.Management;
ManagementScope scope = new ManagementScope(new ManagementPath("some_path"))

PS2请不要告诉我修改web.config文件和更改标记。我知道这是最简单的解决方案,但是,我需要网站自动匹配Windows主机PC的默认密码策略。。。听起来很奇怪,但这是要求。

“这是使用Windows身份验证。”-如果您使用Windows身份验证,则Windows将自行强制执行密码策略,除了自己调用Win32的帐户/密码函数之外,您无需执行任何操作,也无需自己重新实现密码策略引擎。@Dai为什么不将此作为答案发布?@Dai答案是正确的,但是,我仍在寻找访问这些设置的方法。我需要它为用户体验,列出所有的密码要求的网站。我尝试了System.Web.Security.Membership.MinRequiredPasswordLength之类的方法,但它返回了0,这是错误的。