本文介绍了自动路由器重启的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好!
我想制作一个程序,如果它与Internet断开连接,则会自动重新启动路由器.
现在,它导航到正确的站点,但是有一个名为Reboot的按钮.
属性:
输入type ="submit" class ="buttonText" value =重新启动" style ="cursor:hand"
我不能做的是通过webrequest按下该按钮.我已经做过的事情:
Hello!
I would like to make a program which automatically reboots the router if it disconenct from the internet.
Now, it navigates to the right site, but there''s a button called Reboot.
properties:
input type="submit" class="buttonText" value="Reboot" style="cursor:hand"
What I can''t do is pressing that button by webrequest. What I''ve done already:
WebRequest myReq = WebRequest.Create("http://192.168.1.254/GBreboot.htm");
string username = "name";
string password = "pw";
string usernamePassword = username + ":" + password;
CredentialCache mycache = new CredentialCache();
mycache.Add(new Uri("http://192.168.1.254/GBreboot.htm"), "Basic", new NetworkCredential(username, password));
myReq.Credentials = mycache;
myReq.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(usernamePassword)));
WebResponse wr = myReq.GetResponse();
Stream receiveStream = wr.GetResponseStream();
WebResponse response = (WebResponse)myReq.GetResponse();
StreamReader reader = new StreamReader(receiveStream, Encoding.UTF8);
string resphtml = reader.ReadToEnd();
Any ideas?
推荐答案
这篇关于自动路由器重启的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!