• 如何用C#设置IE的代理


    大家好,在上一篇文章中《用C#实现Web代理服务器 》中大家知道了代理服务器的实现和使用。但是使用上文介绍中的方法每次都要设置很麻烦。所以就有了本文《如何用C#设置IE的代理》我以以把主要源码贴出,希望给大家帮助

     1   private void button3_Click(object sender, EventArgs e)
     2         {
     3             //打开注册表键 
     4             Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings"true);
     5 
     6             //设置代理可用 
     7             rk.SetValue("ProxyEnable"1);
     8             //设置代理IP和端口 
     9             rk.SetValue("ProxyServer"this.textBox1.Text.ToString() + ":" + this.textBox2.Text.ToString());
    10             rk.Close();
    11             Factory.ExecuteNonQuery("update  IP set area='1' where address= '" + str1 + "'");
    12             this.dataGridView1.DataSource = Factory.GetDataTable("select * from ip");
    13             MessageBox.Show("成功!!!");
    14         }
    15 
    16         private void button4_Click(object sender, EventArgs e)
    17         {
    18             //打开注册表键 
    19             Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings"true);
    20 
    21             //设置代理不可用 
    22             rk.SetValue("ProxyEnable"0);
    23             rk.Close();
    24             MessageBox.Show("成功!!!");
    25         }
    26
  • 相关阅读:
    在django中使用orm来操作MySQL数据库的建表,增删改
    TCP中的粘包问题,以及用TCP和UDP实现多次聊天
    网络编程概念
    面向对向---封装
    xlrd模块读取Excel表中的数据
    curl和wget的区别和使用
    WebSocke
    HTTP状态码(响应码)
    IO模型
    Redis为什么使用单进程单线程方式
  • 原文地址:https://www.cnblogs.com/top5/p/1575010.html
Copyright © 2020-2023  润新知