How to access a web service using a proxy in c#
I wish to send a HTTP request to a remote 开发者_如何学Goweb service using the specified proxy. Is this achievable? if so how?
Thank you.
var proxy = new WebProxy("proxy.example.com", 8080)
{
Credentials = new NetworkCredential("login", "password") // optional
};
var request = new WebRequest
{
Proxy = proxy // optional. if null - request goes without proxy, obviously
};
var response = request.GetResponse();
精彩评论