您好,登錄后才能下訂單哦!
/// <summary> /// FW300R路由器自動斷線換IP /// </summary> public static void Disconnect() { //斷線請求 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,p_w_picpath/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口設置") > -1)//登錄成功 { Console.WriteLine("斷開登錄成功"); } else { Console.WriteLine("斷開登錄失敗"); } } }
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。