在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
添加引用 1 using Microsoft.Win32; 1.添加域名站点,例如http://www.baidu.com 1 //以添加www.baidu.com为例 2 RegistryKey hkml = Registry.CurrentUser;//读取HKEY_CURRENT_USER 3 string address = @"SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\INTERNET SETTINGS\ZONEMAP\Domains"; 4 RegistryKey key1 = hkml.OpenSubKey(address, true); 5 RegistryKey baidu = key1.CreateSubKey("baidu.com");//新建项 baidu.com按需求替换 6 RegistryKey ww = baidu.CreateSubKey("www");//新建子项 www按需求替换 7 ww.SetValue("https", 0x2, RegistryValueKind.DWord);//赋值 2.添加IP地址站点,例如http://218.66.55.77 1 //以添加218.66.55.77为例 2 RegistryKey hkml = Registry.CurrentUser;//读取HKEY_CURRENT_USER 3 string address = @"SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\INTERNET SETTINGS\ZONEMAP\RANGES"; 4 RegistryKey key1 = hkml.OpenSubKey(address, true); 5 RegistryKey Name1 = key1.CreateSubKey("Name1");//新建项 //Name1可随便改 6 Name1.SetValue(":Range", "218.66.55.77", RegistryValueKind.String);//赋值 218.66.55.77按需求修改 7 Name1.SetValue("http", 0x2, RegistryValueKind.DWord);//赋值
|
请发表评论