Я знаю, что есть тонны вопросов, задающих то же самое, что я задаю на этом самом сайте, но я не могу заставить мой логин работать правильно.
Сайт, на который я пытаюсь войтинаходится здесь
Код, который я использую для этого:
private void wb_scanFile_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (wb_scanFile.Url.ToString() == "http://isitclean.net/index.php")
{
string formUrl = "http://isitclean.net/index.php"; // NOTE: This is the URL the form POSTs to, not the URL of the form (you can find this in the "action" attribute of the HTML's form tag
string formParams = string.Format("username={0}&password={1}", "mine", "mypass");
string cookieHeader;
WebRequest req = WebRequest.Create(formUrl);
req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";
byte[] bytes = Encoding.ASCII.GetBytes(formParams);
req.ContentLength = bytes.Length;
using (Stream os = req.GetRequestStream())
{
os.Write(bytes, 0, bytes.Length);
}
WebResponse resp = req.GetResponse();
cookieHeader = resp.Headers["Set-cookie"];
}
}
В чем здесь проблема?Я не понимаю, почему это не правильно заполняет текстовое поле.