//Retrieve filenname from DB (based on fileid (Guid))
// *SNIP*
string filename = "Dinesh.txt";
if (HttpContext.Current.Request.UserAgent != null &&
HttpContext.Current.Request.UserAgent.ToUpper().Contains("MSIE"))
filename = HttpUtility.UrlEncode(filename,
System.Text.Encoding.UTF8).Replace("+", " ");
context.Response.Charset = "UTF-8";
context.Response.Buffer = false;
context.Response.AddHeader("Content-Disposition",
"attachment; filename=\"" + filename + "\"");
context.Response.AddHeader("Content-Length", "100122334");
//Set the length the file
context.Response.ContentType = "application/octet-stream";
context.Response.Flush();
//Use the Azure API to stream the blob to the user instantly.
// *SNIP*
fileBlob.DownloadToStream(context.Response.OutputStream);