FW300R路由器自动断线换IP

发布时间:2020-07-19 20:56:02 作者:ka43333
来源:网络 阅读:476
 /// <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("断开登录失败");
                }
            }
        }


推荐阅读:
  1. 如何选择自动换IP软件
  2. 快速换ip的方法有哪些

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

路由器 换ip

上一篇:WebService 笔记

下一篇:java自定义注解的使用

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》