其原理是修改注册表,可能会出现权限问题
需要引入using Microsoft.Win32;
using Microsoft.Win32;RegistryKey hkml = Registry.CurrentUser;//读取HKEY_CURRENT_USERstring address = @"SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\INTERNET SETTINGS\ZONEMAP\RANGES";RegistryKey key1 = hkml.OpenSubKey(address, true);RegistryKey Name1 = key1.CreateSubKey("Name1");//新建项 //Name1可随便改Name1.SetValue(":Range", "此处填写IP地址", RegistryValueKind.String);//赋值 Name1.SetValue("http", 0x2, RegistryValueKind.DWord);//赋值
如果觉得《使用C#设置IE可信任站点》对你有帮助,请点赞、收藏,并留下你的观点哦!