Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string loginURI = "http://centreon.company.by/";
- string username = "login";
- string password = "pass";
- string reqString = "useralias="+username+"&"+password +"=pass&submit=Connect+%3E%3E";
- byte[] requestData = Encoding.UTF8.GetBytes(reqString);
- var request = (HttpWebRequest)WebRequest.Create(loginURI);
- request.AllowAutoRedirect = true;
- request.Method = "POST";
- request.ContentType = "application/x-www-form-urlencoded";
- request.ContentLength = requestData.Length;
- using (Stream S = request.GetRequestStream())
- S.Write(requestData, 0, requestData.Length);
- using (var response = (HttpWebResponse)request.GetResponse())
- {
- var newPageCode = new StreamReader(response.GetResponseStream()).ReadToEnd();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement