WebClient web = new WebClient();
var byt = web.DownloadData(path)
This code download data very slowly even application got stuck or hang.
WebClient web = new WebClient();
var byt = web.DownloadData(path)
This code download data very slowly even application got stuck or hang.
it's most likely a proxy issue. try ignoring Internet Explorer proxy settings:
WebClient web = new WebClient();
web.Proxy = null;
var byt = web.DownloadData(path)
To prevent application hanging, it is better to use asynchronous version of DownloadData
- DownloadDataAsync
. Example usage can be seen at this SO question.
Simply - you should create a event handler for DownloadDataCompleted
event and run DownloadDataAsync
. There is no need to use async
or await
modifiers.