Ive searched all of google and i cant seem to find the method for doing this when it seems so simple! All i have is a text box on a webpage, and given the text box id i want to write a value in it and press a button. So far i have:
WebRequest request = WebRequest.Create("http://ps766677/TestWebApplication/Default.aspx");
WebProxy proxy = new WebProxy("455646:8980");
request.Proxy = proxy;
request.Credentials = CredentialCache.DefaultNetworkCredentials;
request.Proxy.Credentials = CredentialCache.DefaultNetworkCredentials;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
Stream dataStream = request.GetRequestStream();
string postData = GetData();
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse response = request.GetResponse();
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
But the actual 'GetData' method is lost on me! Can anyone tell me what the GetData method should contain, im assuming returning a string of some sort of name value collection...