C# webclient and proxy server

前端 未结 7 436
情书的邮戳
情书的邮戳 2020-11-30 04:10

I am using a web client class in my source code for downloading a string using http.

This was working fine. However, the clients in the company are all connected now

7条回答
  •  有刺的猬
    2020-11-30 04:40

    byte[] data;
    using (WebClient client = new WebClient())
    {
        ICredentials cred;
        cred = new NetworkCredential("xmen@test.com", "mybestpassword");
        client.Proxy = new WebProxy("192.168.0.1",8000);
        client.Credentials = cred;
        string myurl="http://mytestsite.com/source.jpg";
        data = client.DownloadData(myUrl);
    }
    
    File.WriteAllBytes(@"c:\images\target.jpg", data);
    

提交回复
热议问题