Code: Select all
public class PostUtility
{
public static string HttpPost(string uri, string parameters)
{
WebRequest webRequest = WebRequest.Create(uri);
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.Headers.Add("Cookie: xxxxx");
webRequest.Method = "POST";
byte[] bytes = Encoding.ASCII.GetBytes(parameters);
Stream os = null;
try
{
webRequest.ContentLength = bytes.Length;
os = webRequest.GetRequestStream();
os.Write(bytes, 0, bytes.Length);
}
finally
{
if (os != null)
{
os.Close();
}
}
return null;
}
}The original is from
http://en.csharp-online.net/HTTP_Post
And theres no offtopic forum