Hello everyone, in the previous articleArticleMedium 《Use C # To implement Web Proxy Server You know how to implement and use the proxy server. However, using the methods described above requires a lot of trouble. So with this Article "how to use C # To set up ie proxy", I want to post the main source code and hope to help you.
1 Private Void Button3_click ( Object Sender, eventargs E)
2 {
3 // Open Registry Key
4 Microsoft. win32.registrykey rk = Microsoft. win32.registry. currentuser. opensubkey ( @" SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Internet Settings " , True );
5
6 // Set proxy availability
7 Rk. setvalue ( " Proxyenable " , 1 );
8 // Set proxy IP address and port
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 ( " Successful !!! " );
14 }
15
16 Private Void Button4_click ( Object Sender, eventargs E)
17 {
18 // Open Registry Key
19 Microsoft. win32.registrykey rk = Microsoft. win32.registry. currentuser. opensubkey ( @" SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Internet Settings " , True );
20
21 // Set proxy unavailable
22 Rk. setvalue ( " Proxyenable " , 0 );
23 Rk. Close ();
24 MessageBox. Show ( " Successful !!! " );
25 }
26