Hi
I have to pause the download on the failure of network or on any error occurred during the downloading from blob storage.
Please
Technology Tips and News
Hi
I have to pause the download on the failure of network or on any error occurred during the downloading from blob storage.
Please
Hi Pawan,
Please confirm how exactly you are trying to download the file from Azure!!
Are you using Storage explorer or Direct from URL or any other method to download file from Azure?
Regards,
Manu Rekhar
Hi i am using cloud blob container here's is my code for downloading
private void _bgw_downloadfile_DoWork(object sender, DoWorkEventArgs e)
{
AddtoLogFile("download file do worker called", "_bgw_downloadfile_DoWork");
try
{
string dwnlocfile = fbd_downloadFileLoc.SelectedPath;
DataGridViewRow row = dgv_downloadfile.CurrentCell.OwningRow;
string filenameazure = row.Cells["filename"].Value.ToString();
string filename = Path.GetFileName(filenameazure);
string fileext = Path.GetExtension(filenameazure);
CloudStorageAccount storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=http;AccountName=" + ACCOUNTNAME + ";AccountKey="
+ ACCOUNTKEY);
// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.GetContainerReference("filetransfer");
CloudBlockBlob blockBlob = container.GetBlockBlobReference(filenameazure);
// Save blob contents to a file.
using (var fileStream = System.IO.File.OpenWrite(dwnlocfile + "\\" + filename))
{
blockBlob.DownloadToStream(fileStream);
}
}
catch (Exception ex)
{
AddtoLogFile(ex.ToString(), "_bgw_downloadfile_DoWork");
}
}
Hi Pawan,
Any updates?
Regards,
Malar.
Hi Malar,
cant find the solution still working using event handler to achieve the goal.
If you have any idea please suggest.
Thanks
Heres the link which I follow to achieve the goal
http://www.codeproject.com/Articles/35954/C-NET-Background-File-Downloader