Удваивание POST данных при httpwebrequest - C#
Формулировка задачи:
Листинг программы
- HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
- req.Method = "POST";
- req.Timeout = 30000;
- req.ContentType = "application/x-www-form-urlencoded";
- byte[] ByteQuery = Encoding.UTF8.GetBytes("username=user123");
- req.ContentLength = ByteQuery.Length;
- req.GetRequestStream().Write(ByteQuery, 0, ByteQuery.Length);
- req.GetRequestStream().Close();
Решение задачи: «Удваивание POST данных при httpwebrequest»
textual
Листинг программы
- req = (HttpWebreq)Webreq.Create(url);
- req.Method = "POST";
- req.Timeout = 30000;
- req.ContentType = "application/x-www-form-urlencoded";
- string post = "username=user123";
- byte[] postByte = new UTF8Encoding().GetBytes(post);
- req.ContentLength = postByte.Length;
- Stream stream = req.GetRequestStream();
- stream.Write(postByte, 0, postByte.Length);
- stream.Close();
- WebResponse response = req.GetResponse();
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д