Hello
I want to restart the router by programatically using c# like to create exe to restart the router
How to do it please give me some idea or any code which will help me
I have used some following codes:
WebRequest routerConnectionObj = WebRequest.Create(routerURL);
routerConnectionObj.PreAuthenticate = true;
// Add the Credentials for login
routerConnectionObj.Credentials = new NetworkCredential("userName", password);
// Type of method Get/ Post
routerConnectionObj.Method = "Post";
string postContent = "connect=+Renew+&refreshScrn=yes";
// Content type may be text or encoded
routerConnectionObj.ContentType = "application/x-www-form-urlencoded";
routerConnectionObj.ContentLength = postContent.Length;
// Get the requested stream and add postContent data
StreamWriter myWriter = new StreamWriter(routerConnectionObj.GetRequestStream());
myWriter.Write(postContent);
myWriter.Close();
//get the response from server
HttpWebResponse responseObj = (HttpWebResponse)routerConnectionObj.GetResponse();
HttpStatusCode statusCode = responseObj.StatusCode;