如何通过注册表,配置IE可信站点,兼容视图,ActiveX策略

Edge浏览器IE模式失效?最新142版本隐藏按钮的3种解决方案 本文针对Edge浏览器142版本中IE模式按钮消失的问题,提供了3种实用解决方案,包括注册表修改、手动添加网站到IE模式列表和企业策略部署方案,帮助用户解决兼容性问题,确保老旧系统正常访问。 阅读详情
 *     参考至:http://blog.csdn.net/hanzengyi/article/details/7409107,

 *     参考至:https://code.csdn.net/snippets/302829 


   网上的太乱,在项目自己进行了整理,开发自己的工具类。此技术为原创,翻版和转摘绝对不究,分享一点。

  

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
using System.Linq;

namespace wlanye
{
    /// <summary>
    /// 默认设置
    /// </summary>
    public static class InternetSettings
    {
        #region ---设置主页---
        private const string ID_IEKEY = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings";
        private const string ID_IEHome = @"Software\Microsoft\Internet Explorer\Main";

        /// <summary>
        /// 设置主页
        /// </summary>
        /// <param name="url"></param>
        public static void SetHomePage(string url)
        {
            var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(ID_IEHome, true);

            if (key != null)
            {
                key.SetValue("Start Page", url);
            }
        }

        /// <summary>
        /// 读取主页
        /// </summary>
        /// <returns></returns>
        public static string GetHomePage()
        {
            var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(ID_IEHome, true);
            if (key != null)
            {
                return Conversion.ToString(key.GetValue("Start Page"), "");
            }
            return "";
        }

        #endregion

        #region ---添加可信站点---
        private const string ID_ZoneMap = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap";
        private const string ID_ZoneMap_Domains = ID_ZoneMap + @"\Domains";
        private const string ID_ZoneMap_Ranges = ID_ZoneMap + @"\Ranges";
        /// <summary>
        /// 添加可信站点
        /// </summary>
        /// <param name="url"></param>
        public static void AddTrustSite(string url)
        {
            UriDomain uriDomain = new UriDomain(url);
            AddTrustSite(uriDomain);
        }

        public static void AddTrustSite(UriDomain uriDomain)
        {
            switch (uriDomain.HostType)
            {
                case UriHostType.Dns:
                    AddTrustSiteByDns(uriDomain);
                    break;
                case UriHostType.IPv4:
                    AddTrustSiteByIPv4(uriDomain);
                    break;
                default:
                    throw new Exception("AddTrustSite:无效的地址类型!");
            }
        }

        /// <summary>
        /// 通过域名添加可信站点
        /// </summary>
        /// <param name="uriDomain"></param>
        private static void AddTrustSiteByDns(UriDomain uriDomain)
        {
            /////////////如果不是IP则在Domains节点下操作///////////////
            RegistryKey domains = Registry.CurrentUser.OpenSubKey(ID_ZoneMap_Domains, true);

            RegistryKey node = domains.OpenSubKey(uriDomain.SubDomain, true);

            //URL没有添加过
            if (node == null)
            {
                node = domains.CreateSubKey(uriDomain.SubDomain);
                RegistryKey pnode = node.CreateSubKey(uriDomain.TopDomain);
                pnode.SetValue(uriDomain.Protocol, 2, RegistryValueKind.DWord);//添加协议对应的值
            }
            else
            {
                RegistryKey pnode = node.OpenSubKey(uriDomain.TopDomain, true);
                //如果协议节点不存在
                if (pnode == null)
                {
                    pnode = node.CreateSubKey(uriDomain.TopDomain);
                    pnode.SetValue(uriDomain.Protocol, 2, RegistryValueKind.DWord);//添加协议对应的值
                }
            }
        }

        /// <summary>
        /// 添加可信站点IPV4
        /// </summary>
        /// <param name="uriDomain"></param>
        private static void AddTrustSiteByIPv4(UriDomain uriDomain)
        {
            ///判断是普通URL还是IP,普通URL在Domains节点下操作,IP在Ranges节点下操作////////////////
            RegistryKey ranges = Registry.CurrentUser.OpenSubKey(ID_ZoneMap_Ranges, true);

            bool has = false;//标识IP是否已经添加
            List<string> numbers = new List<string>();//用来存放Range编号
            //循环所有的range节点,如果要添加的IP已经存在则不操作,否则添加
            foreach (string u in ranges.GetSubKeyNames())
            {
                numbers.Add(u.Substring("Range".Length));//截取Range1后面的数字1
                RegistryKey range = ranges.OpenSubKey(u, true);//以可写的权限打开子节点

                //如果该IP地址已经存在
                if (range.GetValue(":Range").Equals(uriDomain.Address))
                {
                    has = true;
                    if (range.GetValue(uriDomain.Protocol) != null) break;//如果协议也正确说明IP已经是信任节点
                    range.SetValue(uriDomain.Protocol, 2, RegistryValueKind.DWord);//添加协议对应的值
                }
            }
            //如果该IP没有在信任列表则重新添加
            if (!has)
            {
                RegistryKey range = ranges.CreateSubKey("Range" + FindMinNumber(numbers));
                range.SetValue(":Range", uriDomain.Address, RegistryValueKind.String);
                range.SetValue(uriDomain.Protocol, 2, RegistryValueKind.DWord);
            }
        }

        #endregion

        #region ---移除可信站点---
        public static void RemoveTrustSite(string url)
        {
            UriDomain uriDomain = new UriDomain(url);
            RemoveTrustSite(uriDomain);
        }
        /// <summary>
        /// 在注册表删除信任站点
        /// </summary>
        /// <param name="url"></param>
        public static void RemoveTrustSite(UriDomain uriDomain)
        {
            switch (uriDomain.HostType)
            {
                case UriHostType.Dns:
                    RemoveTrustSiteByDns(uriDomain);
                    break;
                case UriHostType.IPv4:
                    RemoveTrustSiteByIPv4(uriDomain);
                    break;
                default:
                    throw new Exception("DeleteTrustSite:无效的地址类型!");
            }
        }

        /// <summary>
        /// 通过可信站点移除
        /// </summary>
        /// <param name="uriDomain"></param>
        private static void RemoveTrustSiteByIPv4(UriDomain uriDomain)
        {
            RegistryKey ranges = Registry.CurrentUser.OpenSubKey(ID_ZoneMap_Ranges, true);

            //循环所有的range节点,如果要添加的IP已经存在则不操作,否则添加
            foreach (string u in ranges.GetSubKeyNames())
            {
                RegistryKey range = ranges.OpenSubKey(u, true);//以可写的权限打开子节点

                //如果该IP地址已经存在
                if (range.GetValue(":Range").Equals(uriDomain.Address))
                {
                    if (range.GetValue(uriDomain.Protocol) != null) range.DeleteValue(uriDomain.Protocol);//如果协议节点存在则先删除
                    if (range.GetValueNames().Length == 1) ranges.DeleteSubKey(u);//只剩下“:Range”则将该节点删除
                }
            }
        }

        /// <summary>
        /// 通过DNS移除
        /// </summary>
        /// <param name="uriDomain"></param>
        private static void RemoveTrustSiteByDns(UriDomain uriDomain)
        {
            RegistryKey domains = Registry.CurrentUser.OpenSubKey(ID_ZoneMap_Domains, true);

            RegistryKey node = domains.OpenSubKey(uriDomain.SubDomain);
            RegistryKey pnode = node.OpenSubKey(uriDomain.TopDomain);
            if (pnode != null)
                node.DeleteSubKey(uriDomain.TopDomain);//删除协议节点
            if (node.GetSubKeyNames().Length == 0)
                domains.DeleteSubKey(uriDomain.SubDomain);//如果没有协议节点则删除该URL节点
        }

        /// <summary>
        /// 获取数字列表里从小到大排列最先却少的那个数字,比如numbers里包含2,3时返回1
        /// </summary>
        /// <param name="numbers">已经使用的数字列表</param>
        /// <returns></returns>
        private static string FindMinNumber(List<string> numbers)
        {
            for (int i = 1; i <= numbers.Count; i++)
            {
                if (numbers.IndexOf(i.ToString()) == -1) return i.ToString();
            }
            return (numbers.Count + 1).ToString();
        }

        #endregion

        #region ---设置兼容视图---
        //兼容性列表在注册表中的位置,注意:不同位的操作系统可能不同,请注意测试。
        private const string ID_CLEARABLE = @"Software\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData";
        private const string ID_USERFILTER = "UserFilter";

        /// <summary>
        /// 得到已经存在的所有兼容网站列表,如果没有,则返回空数组。
        /// </summary>
        /// <returns></returns>
        public static string[] GetCompatibilitySites()
        {
            string[] domains = { };
            try
            {
                using (RegistryKey regkey = Registry.CurrentUser.OpenSubKey(ID_CLEARABLE))
                {
                    //可能不存在此key.
                    Object filterData = regkey.GetValue(ID_USERFILTER);
                    if (filterData != null)
                    {
                        byte[] filter = filterData as byte[];
                        domains = GetCompatibilitySites(filter);
                    }
                }
            }
            catch (Exception ex)
            {
                Debugger.WriteLine(ex.Message);
            }

            return domains;
        }

        /// <summary>
        /// 从byte数组中分析所有网站名称
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static string[] GetCompatibilitySites(byte[] filter)
        {
            List<string> domains = new List<string>();
            int length;
            int offset_filter = 24;
            int totalSize = filter.Length;
            while (offset_filter < totalSize)
            {
                length = BitConverter.ToUInt16(filter, offset_filter + 16);
                domains.Add(System.Text.Encoding.Unicode.GetString(filter, 16 + 2 + offset_filter, length * 2));
                offset_filter += 16 + 2 + length * 2;
            }
            return domains.ToArray();
        }

        /// <summary>
        /// 从兼容性列表中删除一个网站。
        /// </summary>
        /// <param name="domain">要删除网站</param>
        private static void RemoveUserFilter(UriDomain uriDomain)
        {
            String[] domains = GetCompatibilitySites();
            if (!domains.Contains(uriDomain.TopDomain))
            {
                return;
            }
            using (RegistryKey regkey = Registry.CurrentUser.OpenSubKey(ID_CLEARABLE, true))
            {
                object oldData = regkey.GetValue(ID_USERFILTER);
                if (oldData != null)
                {
                    byte[] filter = oldData as byte[];
                    byte[] newReg = GetRemovedValue(uriDomain.TopDomain, filter);

                    if (GetCompatibilitySites(newReg).Length == 0)
                        regkey.DeleteValue(ID_USERFILTER);
                    else
                        regkey.SetValue(ID_USERFILTER, newReg, RegistryValueKind.Binary);
                }
            }
        }

        public static void RemoveUserFilter(string url)
        {
            UriDomain uriDomain = new UriDomain(url);
            RemoveUserFilter(uriDomain);
        }

        /// <summary>
        /// 得到一个网站的存储的数据
        /// </summary>
        /// <param name="domain"></param>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static byte[] GetRemovedValue(string domain, byte[] filter)
        {
            byte[] newReg;
            int length;
            int offset_filter = 24;
            int offset_newReg = 0;
            int totalSize = filter.Length;

            newReg = new byte[totalSize];
            Array.Copy(filter, 0, newReg, 0, offset_filter);
            offset_newReg += offset_filter;

            while (offset_filter < totalSize)
            {
                length = BitConverter.ToUInt16(filter, offset_filter + 16);
                if (domain != System.Text.Encoding.Unicode.GetString(filter, offset_filter + 16 + 2, length * 2))
                {
                    Array.Copy(filter, offset_filter, newReg, offset_newReg, 16 + 2 + length * 2);
                    offset_newReg += 16 + 2 + length * 2;
                }
                offset_filter += 16 + 2 + length * 2;
            }
            Array.Resize(ref newReg, offset_newReg);
            byte[] newSize = BitConverter.GetBytes((UInt16)(offset_newReg - 12));
            newReg[12] = newSize[0];
            newReg[13] = newSize[1];

            return newReg;
        }

        class BinClass
        {
            public byte[] header = new byte[] { 0x41, 0x1F, 0x00, 0x00, 0x53, 0x08, 0xAD, 0xBA };
            public byte[] delim_a = new byte[] { 0x01, 0x00, 0x00, 0x00 };
            public byte[] delim_b = new byte[] { 0x0C, 0x00, 0x00, 0x00 };
            public byte[] checksum = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF };
            public byte[] filler = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 };
        }

        private static void AddCompatibilityView(UriDomain uriDomain)
        {
            byte[] regbinary = new byte[] { };
            BinClass regbinclass = new BinClass();

            String[] domains = GetCompatibilitySites();
            if (domains.Length > 0)
            {
                if (domains.Contains(uriDomain.TopDomain))
                    return;
                else
                    domains = domains.Concat(new String[] { uriDomain.TopDomain }).ToArray();
            }
            else
            {
                domains = domains.Concat(new String[] { uriDomain.TopDomain }).ToArray();
            }

            int count = domains.Length;
            byte[] entries = new byte[0];
            foreach (String d in domains)
            {
                entries = Combine(entries, GetDomainEntry(d, regbinclass));
            }
            regbinary = regbinclass.header;
            regbinary = Combine(regbinary, BitConverter.GetBytes(count));
            regbinary = Combine(regbinary, regbinclass.checksum);
            regbinary = Combine(regbinary, regbinclass.delim_a);
            regbinary = Combine(regbinary, BitConverter.GetBytes(count));
            regbinary = Combine(regbinary, entries);
            Registry.CurrentUser.OpenSubKey(ID_CLEARABLE, true).SetValue(ID_USERFILTER, regbinary, RegistryValueKind.Binary);

            regbinclass = null;
            regbinary = null;
        }

        /// <summary>
        /// 向兼容性列表中添加一个网站
        /// </summary>
        /// <param name="domain"></param>
        public static void AddCompatibilityView(String url)
        {
            UriDomain uriDomain = new UriDomain(url);
            AddCompatibilityView(uriDomain);
        }

        /// <summary>
        /// 得到一个网站在兼容性列表中的数据,跟GetRemovedValue类似
        /// </summary>
        /// <param name="domain"></param>
        /// <returns></returns>
        private static byte[] GetDomainEntry(String domain, BinClass regbinclass)
        {
            byte[] tmpbinary = new byte[0];
            byte[] length = BitConverter.GetBytes((UInt16)domain.Length);
            byte[] data = System.Text.Encoding.Unicode.GetBytes(domain);
            tmpbinary = Combine(tmpbinary, regbinclass.delim_b);
            tmpbinary = Combine(tmpbinary, regbinclass.filler);
            tmpbinary = Combine(tmpbinary, regbinclass.delim_a);
            tmpbinary = Combine(tmpbinary, length);
            tmpbinary = Combine(tmpbinary, data);
            return tmpbinary;
        }

        //把两个byte[]数组合并在一起
        private static byte[] Combine(byte[] a, byte[] b)
        {
            byte[] c = new byte[a.Length + b.Length];
            System.Buffer.BlockCopy(a, 0, c, 0, a.Length);
            System.Buffer.BlockCopy(b, 0, c, a.Length, b.Length);
            return c;
        }

        #endregion

        #region ---调整安全策略---
        private const string ID_Zones = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones";

        /// <summary>
        /// 设置当前策略的值
        /// </summary>
        /// <param name="policys"></param>
        /// <param name="code"></param>
        /// <param name="value"></param>
        public static void SetZonesPolicy(ZonesPolicys policys, string code, uint value)
        {
            var keyname = ID_Zones + "\\" + policys;
            RegistryKey regKeys = Registry.CurrentUser.OpenSubKey(keyname, true);
            if (regKeys != null)
            {
                regKeys.SetValue(code, value);
            }
        }

        /// <summary>
        /// 设置ActiveX的策略,自动打开ActiveX策略
        /// </summary>
        /// <param name="value"></param>
        public static void SetActiveXPolicy(ZonesPolicys policys = ZonesPolicys.Trustedsiteszone, uint value = 0)
        {
            SetZonesPolicy(policys, ZonesPolicyCode.ID_1001, value);
            SetZonesPolicy(policys, ZonesPolicyCode.ID_1004, value);
            SetZonesPolicy(policys, ZonesPolicyCode.ID_1200, value);
            SetZonesPolicy(policys, ZonesPolicyCode.ID_1201, value);
            SetZonesPolicy(policys, ZonesPolicyCode.ID_1405, value);
            SetZonesPolicy(policys, ZonesPolicyCode.ID_2201, value);
        }
        #endregion
    }

    #region ---地址域名类---

    public class UriDomain
    {
        protected string uriString;

        public Uri FullUri { get; protected set; }
        public UriHostType HostType { get; protected set; }
        public bool IsHttps { get; protected set; }
        public string Protocol { get; protected set; }
        public string Address { get; protected set; }
        public string TopDomain { get; protected set; }
        public string SubDomain { get; protected set; }

        public override string ToString()
        {
            return this.uriString;
        }

        public UriDomain(String uriString)
        {
            this.uriString = uriString;
            this.FullUri = new Uri(uriString);
            this.IsHttps = String.Equals(FullUri.Scheme, "https", StringComparison.OrdinalIgnoreCase);
            this.Protocol = FullUri.Scheme;

            this.Address = FullUri.Host;
            this.HostType = GetHostType();
            this.TopDomain = GetTopDomain(Address);
            this.SubDomain = GetSubDomain(TopDomain);
        }

        /// <summary>
        /// 添加二级域名
        /// </summary>
        /// <param name="sDomain"></param>
        /// <returns></returns>
        protected string GetSubDomain(string sDomain)
        {
            var s = sDomain.IndexOf(this.TopDomain);
            if (s > 0)
                return sDomain.Substring(0, s);
            else
                return "";
        }

        /// <summary>
        /// 获得顶级域名
        /// </summary>
        /// <param name="sDomain"></param>
        /// <returns></returns>
        protected string GetTopDomain(string sDomain)
        {
            string[] topList = new string[] { ".com.cn", ".net.cn", ".org.cn", ".gov.cn",
                    ".ac.cn", ".bj.cn", ".sh.cn", ".tj.cn", ".cq.cn", ".he.cn", ".sx.cn", 
                    ".nm.cn", ".ln.cn", ".jl.cn", ".hl.cn", ".js.cn", ".zj.cn", ".ah.cn", 
                    ".fj.cn", ".jx.cn", ".sd.cn", ".ha.cn", ".hb.cn", ".hn.cn", ".gd.cn", 
                    ".gx.cn", ".hi.cn", ".sc.cn", ".gz.cn", ".yn.cn", ".xz.cn", ".sn.cn",
                    ".gs.cn", ".qh.cn",  ".nx.cn", ".xj.cn", ".tw.cn", ".hk.cn", ".mo.cn",
                    ".com", ".net", ".org",".biz", ".info", ".cc", ".tv", ".cn" };

            for (int i = 0; i < topList.Length; i++)
            {
                var toppart = sDomain.Substring(sDomain.Length - topList[i].Length, topList[i].Length).ToLower();
                if (toppart == topList[i])
                {

                    sDomain = sDomain.Substring(0, sDomain.Length - topList[i].Length);//去除域名后缀   
                    if (sDomain.LastIndexOf(".") > 0)
                    {
                        //二级域名,提取顶级域,顺便组合   
                        sDomain = sDomain.Substring(sDomain.LastIndexOf("."), sDomain.Length - sDomain.LastIndexOf(".")) + topList[i];
                        if (sDomain.IndexOf(".") == 0) //第一个为小数点,去掉   
                        {
                            sDomain = sDomain.Substring(1, sDomain.Length - 1);
                        }
                    }
                    else
                    {
                        sDomain += topList[i];//已是顶级域,组合返回   
                    }
                    break;
                }
            }

            return sDomain;

        }

        /// <summary>
        /// 获得域名类型
        /// </summary>
        protected UriHostType GetHostType()
        {
            if (this.FullUri.HostNameType == UriHostNameType.IPv4)
                return UriHostType.IPv4;
            if (this.FullUri.HostNameType == UriHostNameType.Dns)
                return UriHostType.Dns;

            return UriHostType.Invalid;
        }
    }

    public enum UriHostType : int
    {
        Invalid = 0,
        Dns = 1,
        IPv4 = 2,
    }
    #endregion

    #region ---参数类定义---
    public enum ZonesPolicys : uint
    {
        MyComputer = 0,
        LocalIntranetzone = 1,
        Trustedsiteszone = 2,
        Internetzone = 3,
        RestrictedSites = 4
    }

    public class ZonesPolicyCode
    {
        public const string ID_1001 = "1001";//下载已签名的 ActiveX 控件
        public const string ID_1004 = "1004";//下载未签名的 ActiveX 控件
        public const string ID_1200 = "1200";//运行 ActiveX 控件和插件
        public const string ID_1201 = "1201";//对没有标记为安全的 ActiveX 控件进行初始化和脚本运行
        public const string ID_1206 = "1206";//允许 Internet Explorer Webbrowser 控件的脚本
        public const string ID_1400 = "1400";//活动脚本
        public const string ID_1402 = "1402";//Java 小程序脚本
        public const string ID_1405 = "1405";//对标记为可安全执行脚本的 ActiveX 控件执行脚本
        public const string ID_1406 = "1406";//通过域访问数据资源
        public const string ID_1407 = "1407";//允许通过脚本进行粘贴操作
        public const string ID_1601 = "1601";//提交非加密表单数据
        public const string ID_1604 = "1604";//字体下载
        public const string ID_1605 = "1605";//运行 Java
        public const string ID_1606 = "1606";//持续使用用户数据
        public const string ID_1607 = "1607";//跨域浏览子框架
        public const string ID_1608 = "1608";//允许 META REFRESH *
        public const string ID_1609 = "1609";//显示混合内容 *
        public const string ID_1800 = "1800";//桌面项目的安装
        public const string ID_1802 = "1802";//拖放或复制和粘贴文件
        public const string ID_1803 = "1803";//文件下载
        public const string ID_1804 = "1804";//在 IFRAME 中加载程序和文件
        public const string ID_1805 = "1805";//在 Web 视图中加载程序和文件
        public const string ID_1806 = "1806";//加载应用程序和不安全文件
        public const string ID_1807 = "1807";//";//";//  保留 **
        public const string ID_1808 = "1808";//";//";//  保留 **
        public const string ID_1809 = "1809";//使用弹出窗口阻止程序 **
        public const string ID_1A00 = "1A00";//登录
        public const string ID_1A02 = "1A02";//允许持续使用存储在计算机上的 Cookie
        public const string ID_1A03 = "1A03";//允许使用每个会话的 Cookie(未存储)
        public const string ID_1A04 = "1A04";//没有证书或只有一个证书时不提示选择客户证书 *
        public const string ID_1A05 = "1A05";//允许持续使用第三方 Cookie *
        public const string ID_1A06 = "1A06";//允许使用第三方会话 Cookie *
        public const string ID_1A10 = "1A10";//隐私设置 *
        public const string ID_1C00 = "1C00";//Java 权限
        public const string ID_1E05 = "1E05";//软件频道权限
        public const string ID_1F00 = "1F00";//保留 **
        public const string ID_2000 = "2000";//二进制和脚本行为
        public const string ID_2001 = "2001";//运行已用 Authenticode 签名的 .NET 组件
        public const string ID_2004 = "2004";//运行未用 Authenticode 签名的 .NET 组件
        public const string ID_2100 = "2100";//基于内容打开文件,而不是基于文件扩展名 **
        public const string ID_2101 = "2101";//在低特权 Web 内容区域中的网站可以导航到此区域 **
        public const string ID_2102 = "2102";//允许由脚本初始化的窗口,没有大小和位置限制 **
        public const string ID_2200 = "2200";//文件下载自动提示 **
        public const string ID_2201 = "2201";//ActiveX 控件自动提示 **
        public const string ID_2300 = "2300";//允许网页为活动内容使用受限制的协议 **
    }
    #endregion
}

代码怎么使用呢?

private void btnDelSite_Click(object sender, EventArgs e)
        {
            try
            {
                this.SaveConfig();
                InternetSettings.RemoveTrustSite(this.cmbUrl.Text);
                InternetSettings.RemoveUserFilter(this.cmbUrl.Text);

                Window.MessageBox(this, MsgType.Info, "设置可信站点成功!");
            }
            catch (Exception ex)
            {
                Window.MessageBox(this, MsgType.Error, "设置可信站点失败!错误原因:" + ex.Message);
                return;
            }
        }

        private void btnAddSite_Click(object sender, EventArgs e)
        {
            try
            {
                InternetSettings.AddTrustSite(this.cmbUrl.Text);
                InternetSettings.AddCompatibilityView(this.cmbUrl.Text);
                InternetSettings.SetActiveXPolicy();
                this.SaveConfig();
                Window.MessageBox(this, MsgType.Question, "设置可信站点成功!");
            }
            catch (Exception ex)
            {
                Window.MessageBox(this, MsgType.Error, "设置可信站点失败!错误原因:"+ ex.Message);
                return;
            }
        }


快速配置Internet Explorer的注册表技巧 本文还有配套的精品资源,点击获取 简介:“一键配置IE.rar”包含用于简化和快速配置Internet Explorer浏览器的注册表文件。用户通过导入这些预设的注册表设置可以调整安全、隐私、加载项、主页、兼容性视图、搜索引擎、代理服务器和字体等选项。这种工具虽然方便,但使用不当可能导致系统问题,因此建议先备份注册表,并确保来源的可信度。 1. Internet ... 阅读详情

相关推荐

ClearableListData--获取IE的兼容性视图网站

获取IE的兼容性视图,可以VC获取 IE的兼容性视图 ,好不容易找到的资源,只有获取功能,其他的功能请参看我的其他资源。如果没有积分,请私信给我邮箱,我会尽快把代码发过去的

windows服务器ie兼容视图信息注册表项

计算机\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData\UserFilter

wo1769815的专栏 1250

注册表添加IE信任站点及启用ActiveX控件

一个关于如何通过修改注册表,达到添加IE信任站点及启用ActiveX控件的压缩包。其中,包含详细的使用说明,及注册表项的解释。兼容IE8、IE9、IE10、IE11,在WinXP、Win7平台上均已测试通过。

C# 实现向浏览器的兼容性视图列表中添加、删除网站和检查网站是否在兼容性网站列表中

今天回答论坛上的一个问题,搜索了一下网上,并找到

【孟子E章】 1万+

ClearableListData--添加IE的兼容性视图

ClearableListData--添加IE的兼容性视图,可以VC添加 IE的兼容性视图 ,好不容易找到的资源,只有添加功能,其他的功能请参看我的其他资源。如果没有积分,请私信给我邮箱,我会尽快把代码发过去的

从论文到生产:iSLIP优先级匹配算法在SDN交换机中的20年演进史

本文回顾了iSLIP优先级匹配算法在SDN交换机中的20年演进历程,从斯坦福大学的原始论文到现代芯片实现。通过独特的指针滑动和迭代循环机制,iSLIP算法显著提升了交换机的吞吐量和公平性,解决了传统FIFO调度的队头阻塞问题。文章详细探讨了算法在硬件实现中的工程挑战、开源实践及未来AI时代的智能调度方向。

weixin_29230649的博客 339

自动更改Iexplore的Active x设置,添加可信站点,允许弹窗,自动清理

判断项有Active x,可信站点,阻止弹窗,每次退出清理 实现登录系统时进行判断,不满足时自动运行批处理文件修改IE设置,重启浏览器并返回登录页 ———————————— //获取注册表数值数据 判断注册表Range100项是否存在 private bool IsRegeditItemExist() { string[] subkeyN...

weixin_34227447的博客 209

CHIP-Seq数据分析流程

文章目录CHIP-Seq数据分析流程相关软件安装数据下载将SRA转化为fastq文件数据质控,过滤数据质控然后进行质控,过滤低质量reads,去接头比对下载小鼠参考基因组的索引和注释文件比对sam文件转bam为bam文件建立索引载入IGV查看用MACS call peak安装MACS结果注释与可视化 CHIP-Seq数据分析流程 相关软件安装 所需要的软件有sratoolkit, fastqc,bowtie2,samtools,macs2,htseq-count,bedtools和前面RNA-seq数据分析

bio_meimei的博客 8796

IE浏览器兼容性视图设置数据解析

兼容性视图设置注册表位置:数据类型:REG_BINARY数据结构: 一、数据头 8字节前缀(固定值:“411F00005308ADBA”) 4字节网址数目(低位字节在前) 4字节数据段长度(数据段长度(含自身长度4),低位字节在前) 4字节分隔符(固定值:“01000000”) 4字节网址数目(低位字节在前)二、数据体(按网址循环): 4字节分隔符(固定值:“0C000000”) 8字节时间戳 4字节分隔符(固定值:“01000000”) 2字节网址长度(低位字节在前) 网址字符串(小UTF16编码)...

thb_cn的博客 2060

让 AI 变聪明的 20 条指令:如何让大模型回答得更精准、更专业、更实事求是

让 AI 变聪明,本质上不是写几句神奇咒语,而是把你的任务表达得更清楚,把事实标准设得更严格,把输出格式规定得更明确,把不确定性管理得更认真,把历史对话利用得更充分。大模型的强项是语言生成、信息组织、模式归纳和方案扩展;弱项是事实核验、实时更新、责任判断和对模糊意图的准确猜测。好的指令,就是在用人的判断弥补模型的弱点,让模型把强项发挥在正确的地方。

Sumarua的博客 1635

手把手教你用Foobar2000播放DSD音频(含DOP设置与SPDIF输出教程)

本文详细指导如何在Foobar2000中播放DSD音频,重点解析了DOP协议的原理与设置方法。通过安装SACD插件、配置输出设备及启用DOP模式,实现DSD音频的原生比特流输出,并特别讲解了如何通过SPDIF接口传输DSD信号,帮助发烧友充分释放高清音频设备的潜力。

weixin_29290963的博客 1874

注册表Windows兼容性设置(AppCompatFlags)

下载ADK,然后只安装里面的 程序兼容性助手 可以查看当前系统中用户设置,也可以看到系统自带的兼容性数据库中对程序的识别参数和设置。还有些特殊字段不是通过 属性 - 兼容性 对话框设置,如:DWM8And16BitMitigation。Layers下以进程的全路径为Key,类型为REG_SZ,值为一个以空格的字符串,界面上每个选项对应一个字符串。EXE文件属性中有兼容性标签,当有些老版本软件不能正常运行时经常会调整这里的设置。上面的所有选项都写在注册表中,其中“更改所有用户的设置”保存在。

5109

搭建一个简单的 Django + Vue 项目

在本文中,我将为您详细介绍如何搭建一个简单的 Django + Vue 项目。Django 是一个使用 Python 编写的高级 Web 框架,而 Vue 是一个流行的 JavaScript 框架,用于构建用户界面。通过结合 Django 和 Vue,我们可以创建强大的全栈 Web 应用程序。创建 Django 项目设置 Django 后端创建 Vue 前端连接 Django 和 Vue让我们开始吧!

JfpBlockchain的博客 356

修改IE设置(修改注册表)允许活动内容在"我的电脑"的文件运行

最近有个项目用IE打开页面总是弹一个“Internet Explorer已限制此网页运行脚本或ActiveX控件”,因为在我的网页中加了JS文件,所以会有这个提示,为了不让用户手工设置IE,所以只能通过程序来修改IE配置。 看了几个文章,确定的是要勾选IE高级设置中的“允许活动内容在"我的电脑"的文件运行”,如下图所示。 勾选上这个就不会弹上边提示框了。 我看了百度的资料有点少,有两个注册表的...

发呆的程序猿 4733

【RT-DETR涨点改进】ICML 2026顶会 | 独家Conv改进篇| 引入PloyConv多项式卷积,增强不同尺度空间信息的交互,适合小目标检测、遥感目标检测,含8种创新改进,有效涨点

🔥本文给大家介绍使用 PloyConv多项式卷积 改进RT-DETR网络模型,PloyConv将传统可分离卷积中依赖GELU等激活函数的空间混合方式,改造成由两个异构深度卷积分支驱动的多项式空间混合:粗粒度空洞卷积分支负责大范围上下文,细粒度3×3卷积分支负责局部纹理,并通过通道翻转增加两路特征差异,再通过逐元素乘法建立跨尺度非线性交互,最后利用卷积进行空间整合和通道映射。 它最大的特点是实现了“大感受野上下文 + 局部细节 + 跨尺度乘法交互 + 无点激活空间建模”的统一。

Ai缝合怪、助力小伙伴高效发论文 118

[Python人工智能] 三十六.基于Transformer的商品评论情感分析 (2)keras构建多头自注意力(Transformer)模型

本专栏开始,作者正式研究Python深度学习、神经网络及人工智能相关知识。前一篇文章利用Keras构建深度学习模型并实现了情感分析。这篇文章将介绍Transformer基础知识,并通过Keras构建多头自注意力(Transformer)模型,实现IMDB电影影评数据情感分析。基础性文章,希望对您有所帮助!...

杨秀璋的专栏 4912

使用批处理添加受信任站点和设置ie安全级别

比如说我们要把www.baidu.com 、.google.com添加到客户的受信任站点 蓝色部分后面有www(baiud.com\www)的为www.baidu.com 不加的话默认为* 例:*.google.com "红色部分为可修改的协议:例如:"http","ftp"等其它名称。 代码如下: reg add "HKEY_CURRENT_USER\Software\Microsof

IT民工 4万+

Cadence PCB仿真 使用Allegro PCB SI为BRD文件创建通用型IBIS模型的方法图文教程

本文简单介绍使用Allegro PCB SI软件为BRD PCB设计文件中的元器件创建IBIS模型的方法。

fydar的博客 2178

Windows Edge 兼容性问题修复

修复Windows Edge兼容性问题可尝试:1. 更改注册表,新建DWORD值`RendererCodeIntegrityEnabled`设为0。2. 修改可执行文件名,将`edge.exe`或`msedge.exe`改为`chrome.exe`。3. 启用兼容性列表,在`about:flags`中启用“使用Microsoft兼容性列表”选项并重启。如问题依旧,可能需检查系统环境和软件版本。操作前请备份数据。

专注于全栈开发领域 2366

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

通过注册表设置IE的ActiveX运行选项

请尊重作者劳动成果,尊重版权。转载或转发帖请注明本链接地址 1:设置安全选项 IE设置的注册表项:HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones Zones下的4个子项: Value Setting -------------------------

wwwwxhh的专栏 4297

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

win10的注册表配置-IE兼容性视图

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Main\EnterpriseMode]"Enable"=""显示IE11工具菜单上的“企业模式”当在Win8.1下的IE11兼容性列表中添加网站以后,但是以后再打开浏览器会发现刚才添加的网址和设置都丢失了,请问这个问题该如何处理? 在排错...

weixin_34124939的博客 5440

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

影响IE的兼容性视图 (CV) 列表的第二个注册表键值(未包含在官方指南中)

再上一篇日志中IE的兼容性视图 (CV) 列表,讲述一个在官方文档中可以搜索到的影响CV列表的注册表项,而今天在继续研究CV列表的过程中又陆续发现了另一个未出现在官方文档中的注册表项,此项同样能够影响CV列表,同时可以提供测试Windows UI界面下的IE播放Flash的域名。 如果需要测试两个域名下面的Windows UI兼容性可以直接这样来添加。 Figure 1此图来自...

weixin_33892359的博客 279

Internet Explorer 设置 注册表中设置IE(Windows安全设置之注册表项)

Windows安全设置之注册表项 在IE4.0以上的版本中,IE的安全设置一般都存贮在这两个地方: 1、HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings 2、HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Inte

dangerous_fire的专栏 1万+

通过修改配置项进行IE设置

通过注册表修改 Internet Explorer (IE) 的配置项需要小心操作,因为不当修改可能会导致系统问题或浏览器崩溃。以下是一些常见的 IE 配置项修改方式,适用于 Windows 注册表。HKEY_LOCAL_MACHINE – 系统级的设置(通常需要管理员权限)。HKEY_CURRENT_USER – 当前用户的设置。

LKIDTI数据的博客 2232
上一篇: 计算机概念:抽象和具象的关系和联系
下一篇: 微信小程序的一些限制
鹧鸪菜
博客等级 码龄21年 330粉丝 115原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值