Get it (this will be a string)?
I have to post two values, and sometimes more, I see in these examples where this posting string posts = "a string to post"; But how will I tell that I am saying that there are many form values?
to
// Create a request using such URLs WebRequest requests can be found by posting = WebRequest.Create ("http://contoso.com/PostAccepter.aspx"); // Set the property property of request to post. request. Method = "post"; // Create the post data and convert it to a byte array. String postData = "This is an exam that posts this string to a web server."; Byte [] Bytere = Encoding. UTF8.GetBytes (PostData); // Set the ContentType property of WebRequest Request.ContentType = "application / x-www-form-urlencoded"; // Set the ContentLength property of WebRequest Request.ContentLength = byteArray.Length; // Receive Request Stream Stream Data Stream = Request. GETRequestStream (); // Write the data in the request stream. Datastream Write (byte, 0, byte length); // Close the stream object Datastream.Close (); // Receive feedback WebResponse response = Request GetResponse (); // display status console. Light line (((HTTP web response) response). Tets Description;); // Receive stream containing content returned from server datastream = response. Gateresonsstream (); // Open stream using stream reader for easier access; Streamminder Reader = new streamrider (datastream); // Read String Response Forms = Reader Readout (); // Display content console; light line (responseformser); // Clear the currents reader Stop it (); Datastream.Close (); reaction. Stop it ();
Note that the information is in the format key1 = value1 and. Key2 = value2
Comments
Post a Comment