开发者

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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜