c# send get responce/request

using System.Net;
using System.Collections.Specialized;
POST
using (var client = new WebClient())
{
    var values = new NameValueCollection();
    values["thing1"] = "hello";
    values["thing2"] = "world";

    var response = client.UploadValues("http://www.mydomain.com/recepticle.aspx", values);

    var responseString = Encoding.Default.GetString(response);
}
GET
using (var client = new WebClient())
{
    var responseString = client.DownloadString("http://www.mydomain.com/recepticle.aspx");
}
WebProxy wproxy = new WebProxy("10.10.0.2:8080", true);
wproxy.Credentials = new NetworkCredential("int", "FSinet1234", "fsrar");
webclient.Proxy=wpproxy;


http://stackoverflow.com/questions/4015324/http-request-with-post

No comments:

Post a Comment

Note: only a member of this blog may post a comment.