/// <summary> /// Check the file information. /// </summary> private void btnCheckUrl_Click(object sender, EventArgs e) { // Initialize an instance of HttpDownloadClient. client = new HttpDownloadClient(tbURL.Text); try { string filename = string.Empty; client.CheckUrl(out filename); string path = Path.Combine(Constants.ContainerLocation, Constants.Directories.GetSpecifiedCaseDirectory(Actions.Download), client.Url.Segments.Last()); if (string.IsNullOrEmpty(filename)) { DownloadPath = path; } else { DownloadPath = path; } this.tbURL.Enabled = false; this.btnCheckUrl.Enabled = false; this.tbPath.Enabled = false; this.btnDownload.Enabled = true; } catch { // If there is any exception, like System.Net.WebException or // System.Net.ProtocolViolationException, it means that there may be an // error while reading the information of the file and it cannot be // downloaded. MessageBox.Show("There is an error while get the information of the file." + " Please make sure the url is accessible."); } }