I'm downloading a pdf file from Azure blob storage and specify the local file name and extension.
It downloads fine to the downloads directory but with the name Microsoft.WidowsAzure.Storage.Blob
file name and no extension.
I want to specify the file name not the directory which is fine.
MemoryStream memStream = new MemoryStream();
blockBlob.DownloadToStream(memStream);
HttpContext.Current.Response.ContentType = blockBlob.Properties.ContentType.ToString();
// Response.AddHeader("Content-Disposition", "Attachment; filename=" + blobName.ToString());
HttpContext.Current.Response.AddHeader("Content-Disposition", "Attachment; filename=" + blockBlob.ToString());
HttpContext.Current.Response.AddHeader("Content-Length", blockBlob.Properties.Length.ToString());
HttpContext.Current.Response.BinaryWrite(memStream.ToArray());
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.Close();