Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/366.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注册表禁用IE11中的自动完成_C#_.net_Internet Explorer_Autocomplete_Registry - Fatal编程技术网

C# 通过Windows注册表禁用IE11中的自动完成

C# 通过Windows注册表禁用IE11中的自动完成,c#,.net,internet-explorer,autocomplete,registry,C#,.net,Internet Explorer,Autocomplete,Registry,我正在尝试在c#应用程序中使用Windows注册表禁用Internet Explorer 11自动完成表单上的用户名和密码 以下代码有时有效(浏览器停止请求保存密码,并且自动完成设置中的复选框未选中),有时则失败(也就是说,没有例外,但浏览器仍会询问您是否要保存密码,并且自动完成设置中的复选框已选中) 我的问题: 是否有另一个密钥控制密码保存,或者可能由于用户的权限而失败?还是我给子键指定了错误的值?为什么它有时会起作用,而另一些却会默默地失败 另一个问题:如果一个网站正在运行,它显示的网页就像

我正在尝试在c#应用程序中使用Windows注册表禁用Internet Explorer 11自动完成表单上的用户名和密码

以下代码有时有效(浏览器停止请求保存密码,并且自动完成设置中的复选框未选中),有时则失败(也就是说,没有例外,但浏览器仍会询问您是否要保存密码,并且自动完成设置中的复选框已选中)

我的问题: 是否有另一个密钥控制密码保存,或者可能由于用户的权限而失败?还是我给子键指定了错误的值?为什么它有时会起作用,而另一些却会默默地失败

另一个问题:如果一个网站正在运行,它显示的网页就像被早期版本的浏览器浏览一样,那么IE11是否会使用旧版本的注册表项(例如,
HKEY\U CURRENT\U USER\Software\Microsoft\Internet Explorer\AutoComplete
?)

编辑: 此后,我发现了其他几个与自动完成相关的注册表项,但不清楚这些注册表项适用于哪个版本的Internet Explorer。一般来说,似乎很难找到有关IE11注册表设置的信息

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\AutoComplete
HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Control Panel\FormSuggest
HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Control Panel\FormSuggest Password 

加载Internet选项->自动完成时,Internet Explorer也可以访问这些键:

HKCU\Software\Microsoft\Internet Explorer\DomainSuggestion\Enabled
HKLM\Software\Microsoft\Internet Explorer\DomainSuggestion
HKCU\Software\Microsoft\Internet Explorer\Main\Use FormSuggest
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoComplete
HKCU\Software\Policies\Microsoft\Windows\CurrentVersion\Explorer\AutoComplete
windows explorer和internet explorer似乎共享一些自动完成选项


您可以使用一些注册表监视工具查看“兼容性”视图中正在访问的内容。这就是我如何找到这些注册表项的。

为注册表项设置访问控制可能有助于解决您的问题

范例

 string user = Environment.UserDomainName + "\\" + Environment.UserName;
    RegistrySecurity regSecurity = new RegistrySecurity();

    rs.AddAccessRule(new RegistryAccessRule(user, 
                RegistryRights.ReadKey | RegistryRights.WriteKey, 
                InheritanceFlags.None, 
                PropagationFlags.None, 
                AccessControlType.Allow));

    RegistryKey regKey1 = null;
            try
            {
                regKey1 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Internet Explorer\Main", 
                    RegistryKeyPermissionCheck.Default, rs);                    
                regKey1.SetValue("FormSuggest Passwords", "no",RegistryValueKind.String);
            }
            catch (Exception ex)
            {
                Console.WriteLine("\r\nUnable to read key: {0}", ex);
            }

谢谢,我会看一下,看看这是否能解决问题。由于此问题的性质不一致,测试可能需要一段时间。不确定这是否回答了我的问题,但感谢您的尝试。仍然有一个想法:让自动完成保存一些密码,发现它存储的位置,并让程序在重新启动时清除它。这在你的情况下可行吗?对同一个用户来说失败了吗?或者它是在开发环境中工作,而不是在部署中工作?不是同一个用户,它在开发环境中100%工作,但有时在部署中失败。我开始认为其中一些注册表项需要管理权限。
 string user = Environment.UserDomainName + "\\" + Environment.UserName;
    RegistrySecurity regSecurity = new RegistrySecurity();

    rs.AddAccessRule(new RegistryAccessRule(user, 
                RegistryRights.ReadKey | RegistryRights.WriteKey, 
                InheritanceFlags.None, 
                PropagationFlags.None, 
                AccessControlType.Allow));

    RegistryKey regKey1 = null;
            try
            {
                regKey1 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Internet Explorer\Main", 
                    RegistryKeyPermissionCheck.Default, rs);                    
                regKey1.SetValue("FormSuggest Passwords", "no",RegistryValueKind.String);
            }
            catch (Exception ex)
            {
                Console.WriteLine("\r\nUnable to read key: {0}", ex);
            }