private static string PostURI(string URI, string Parameters)
{
string CommandURI = URI;
WebRequest myWebRequest = WebRequest.Create(CommandURI);
//needed only if outbound traffic must go through a proxy server
//WebProxy proxyObject = new WebProxy("
http://MyProxyServer:80/",true);
//myWebRequest.Proxy = proxyObject;
myWebRequest.ContentType = "application/x-www-form-urlencoded";
myWebRequest.Method = "POST";
byte [] bytes = System.Text.Encoding.ASCII.GetBytes(Parameters);
myWebRequest.ContentLength = bytes.Length;
Stream OutputStream = myWebRequest.GetRequestStream ();
OutputStream.Write (bytes, 0, bytes.Length);
OutputStream.Close ();
WebResponse MyWebResponse = myWebRequest.GetResponse();
Stream MyStream = MyWebResponse.GetResponseStream();
StreamReader MyStreamReader = new StreamReader(MyStream);
return MyStreamReader.ReadToEnd().Trim();
}