Download file from the internet with C

WebClient client = new WebClient();
client.UseDefaultCredentials = true;
client.Proxy.Credentials = CredentialCache.DefaultCredentials;
client.Encoding = Encoding.UTF8;
String s = client.DownloadString(textBox1.Text);

The line:

client.Proxy.Credentials = CredentialCache.DefaultCredentials;

is needed if you have a proxy. This uses the default setting from Windows.

Werbung



comments powered by Disqus

Copyright Dunkel & Iwer GbR | Datenschutzerklärung | Impressum