C # Use the HttpHelper universal framework to restart the router,

Source: Internet
Author: User

C # Use the HttpHelper universal framework to restart the router,

First, declare that not all routers can restart the vro through the following code.

The following code tests the router is (TP-LINK TD-W89841N reinforced ). Write code based on your vro.

1 using CsharpHttpHelper; // reference the HttpHelper class library 2 using System; 3 using System. text; 4 5 namespace ConsoleApplication1 6 {7 class Program 8 {9 static void Main (string [] args) 10 {11 HttpHelper http = new HttpHelper (); 12 HttpItem item = new HttpItem () 13 {14 Referer =" http://192.168.1.1/ ", 15 // This cannot be less than 16 URLs =" http://192.168.1.1/ Cgi? 7 ", 17 Method =" Post ", 18 Postdata =" [ACT_REBOOT #, #,] \ r \ n ", 19 // the \ r \ n at the end cannot be less than 20 cookies = "Authorization = Basic XXXXXXXXXXXXXXX =", 21 // Authorization = Basic Base64 encrypt your password 22 23 }; 24 HttpResult result = http. getHtml (item); 25 if (result. statusCode = System. net. httpStatusCode. OK) 26 {27 if (result. html = "[error] 0") 28 {29 Console. writeLine ("vro restarted successfully! "); 30} 31 else32 {33 Console. WriteLine (result. Html); 34} 35} 36 Console. ReadKey (); 37} 38} 39}

HttpHelper universal framework Web site: http://httphelper.sufeinet.com/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.