Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string param = "username=kerimemre@yahoo.com&password=123456";
- string url = "http://176.53.10.219:8089/login";
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
- request.Method = "POST";
- request.ContentLength = param.Length;
- request.ContentType = "application/x-www-form-urlencoded";
- request.CookieContainer = new CookieContainer();
- using (Stream stream = request.GetRequestStream())
- {
- byte[] paramAsBytes = Encoding.Default.GetBytes(param);
- stream.Write(paramAsBytes, 0, paramAsBytes.Count());
- }
- using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
- {
- MessageBox.Show(response.ToString());
- MessageBox.Show(response.Cookies.ToString());
- foreach (var cookie in response.Cookies)
- {
- var properties = cookie.GetType()
- .GetProperties()
- .Select(p => new
- {
- Name = p.Name,
- Value = p.GetValue(cookie)
- });
- foreach (var property in properties)
- {
- MessageBox.Show(property.Value.ToString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement