/// <Summary> /// fw300r router automatic disconnection for IP address /// </Summary> Public static void disconnect () {// disconnection request string uri = "http: // 192.168.1.1/userrpm/pppoecfgrpm.htm? WAN = 0 & wantype = 2 & ACC = 07720090868 & psw = hello123world & confirm = hello123world & specialdial = 100 & sectype = 0 & sta_ip = 0.0.0.0 & sta_mask = 0.0.0.0 & linktype = 2 & disconnect = % B6 % CF + % CF % DF "; string suser = "admin"; string spwd = "admin"; string sdomain = ""; networkcredential ocredential; httpwebrequest orequest = (httpwebrequest) webrequest. create (URI); If (orequest! = NULL) {orequest. protocolversion = httpversion. version11; // send request orequest. method = "get"; orequest. contenttype = "application/X-WWW-form-urlencoded"; orequest. useragent = "Mozilla/5.0 (Windows NT 6.1; wow64) applewebkit/537.36 (khtml, like gecko) Chrome/37.0.2062.124 Safari/537.36"; orequest. referer = "http: // 192.168.1.1"; orequest. headers. add ("Authorization", "Basic ywrtaw46ndy2njyynzc =" ); Orequest. keepalive = true; orequest. accept = "text/html, application/XHTML + XML, application/XML; q = 0.9, image/webp, */*; q = 0.8"; if (suser! = String. empty) {ocredential = new networkcredential (suser, spwd, sdomain); orequest. credentials = ocredential. getcredential (New uri (URI), String. empty);} else {orequest. credentials = credentialcache. defaultcredentials;} streamreader sr = new streamreader (orequest. getresponse (). getresponsestream (), system. text. encoding. default); string line = sr. readtoend (); Sr. close (); If (line. indexof ("Wan Port Settings")>-1) // logon successful {console. writeline ("disconnected successfully");} else {console. writeline ("failed to log on disconnected ");}}}
Fw300r router automatic disconnection for IP Address