public bool UploadFile(string filename, string url) { bool result = false; lastErrorMessage = ""; WebClientTimeOut wc = new WebClientTimeOut(); wc.TimeOut = 360000; if (credentials != null) { wc.Credentials = credentials; } try { wc.UploadFile(url, filename); result = true; } catch (Exception e) { lastErrorMessage = e.Message; } return(result); }
public bool DownloadFile(string url, string filename, int timeout) { bool result = false; lastErrorMessage = ""; WebClientTimeOut wc = new WebClientTimeOut(); if (credentials != null) { wc.Credentials = credentials; } wc.TimeOut = timeout; try { wc.DownloadFile(url, filename); result = true; } catch (Exception e) { lastErrorMessage = e.Message; } return(result); }