Below example demonstrates how we can send the GET or POST requests through proxy in C#.Net
HttpWebRequest getRequest = (HttpWebRequest)WebRequest.Create("https://www.yahoo.com");
//set the proxy server and authentication info for this request
//provide the name of proxy server and port address
WebProxy myproxy = new WebProxy("proxyserver:8080", true);
//provide the user id and password for authentication to pass through proxy server
myproxy.Credentials = new NetworkCredential("userId", "Password");
getRequest.Proxy = myproxy;
//send the request and get Response from server
HttpWebResponse response = (HttpWebResponse)getRequest.GetResponse();
Stream datastream = response.GetResponseStream();
StreamReader reader = new StreamReader(datastream);
String responsefromServer = reader.ReadToEnd();
Console.WriteLine("Response from the server is -> " + responsefromServer );
What do you think on this topic? Please express your opinion through comment below. You can write to me at reply2sagar@gmail.com
HttpWebRequest getRequest = (HttpWebRequest)WebRequest.Create("https://www.yahoo.com");
//set the proxy server and authentication info for this request
//provide the name of proxy server and port address
WebProxy myproxy = new WebProxy("proxyserver:8080", true);
//provide the user id and password for authentication to pass through proxy server
myproxy.Credentials = new NetworkCredential("userId", "Password");
getRequest.Proxy = myproxy;
//send the request and get Response from server
HttpWebResponse response = (HttpWebResponse)getRequest.GetResponse();
Stream datastream = response.GetResponseStream();
StreamReader reader = new StreamReader(datastream);
String responsefromServer = reader.ReadToEnd();
Console.WriteLine("Response from the server is -> " + responsefromServer );
What do you think on this topic? Please express your opinion through comment below. You can write to me at reply2sagar@gmail.com