Guest User

Untitled

a guest
Jan 22nd, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. System.IO.File.WriteAllBytes(@"C:UsersPersonDownloadsresults.pdf", bytes)
  2.  
  3. byte[] bytes = ms.ToArray();
  4. HttpResponse response = HttpContext.Current.Response;
  5. response.Clear();
  6. response.Buffer = true;
  7. response.AddHeader("Accept-Header", bytes.Length.ToString());
  8. response.AddHeader("Content-Length", bytes.Length.ToString());
  9. response.AddHeader("Content-Disposition", "attachment;filename=Results.pdf");
  10. response.AddHeader("Content-Description", "File Download");
  11. response.ContentType = "application/octet-stream";
  12. response.OutputStream.Write(bytes, 0, onvert.ToInt32(bytes.Length));
  13.  
  14. //I've tried using this as well
  15. //response.BinaryWrite(bytes);
  16. response.Flush();
  17. response.End();
Add Comment
Please, Sign In to add comment