TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sadashiv chavan
NA
3
10.5k
How to restart the router by programatically using c#
Mar 5 2012 9:53 AM
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;
Reply
Answers (
2
)
Updating connection string in app.config permanenlty from c#
this reference