ASCIIEncoding encoding=new ASCIIEncoding();
string postData="txtValue=value";
byte[] data = encoding.GetBytes(postData);
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create("http://server/Application");
myRequest.Method = "POST";
myRequest.ContentType="application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream=myRequest.GetRequestStream();
// Send the data.
newStream.Write(data,0,data.Length);
newStream.Close();
WebResponse webResponse = myRequest.GetResponse();
StreamReader srData = new StreamReader(webResponse.GetResponseStream());
MessageBox.Show(srData.ReadToEnd());
No comments:
Post a Comment