Guest User

Untitled

a guest
Aug 17th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. Write Word Doc On The Fly
  2. Response.AddHeader("Content-type", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
  3. Response.AppendHeader("Content-disposition", "attachment; filename=Bio.docx");
  4. Response.BinaryWrite(lawyerBio.MakeDoc());
  5.  
  6. Array
  7. (
  8. [0] => HTTP/1.1 200 OK
  9. [1] => Cache-Control: no-cache, no-store
  10. [2] => Pragma: no-cache
  11. [3] => Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
  12. [4] => Expires: -1
  13. [5] => Server: Microsoft-IIS/7.5
  14. [6] => Set-Cookie: website#sc_wede=1; path=/
  15. [7] => Set-Cookie: website#lang=en; path=/
  16. [8] => Set-Cookie: ASP.NET_SessionId=zabhwz55brq0ebfyjqn1c3bm; path=/; HttpOnly
  17. [9] => Content-Disposition: attachment; filename=Bio.docx
  18. [10] => X-AspNet-Version: 2.0.50727
  19. [11] => Set-Cookie: SC_ANALYTICS_GLOBAL_COOKIE=323F079A90B545F39F8A6A9EB9B919DB; expires=Fri, 26-Oct-2012 17:44:57 GMT; path=/
  20. [12] => Set-Cookie: SC_ANALYTICS_SESSION_COOKIE=118B88825A054BA1BAF327B0561C3EBB,1; path=/
  21. [13] => X-Powered-By: ASP.NET
  22. [14] => Date: Thu, 27 Oct 2011 17:44:57 GMT
  23. [15] => Connection: close
  24. [16] => Content-Length: 169581
  25. )
  26.  
  27. byte[] buffer = new byte[4096];
  28. using (Stream s = new FileStream(filePath, FileMode.Open, FileAccess.Read))
  29. {
  30. int bytes;
  31. while ((bytes = s.Read(buffer, 0, buffer.Length)) > 0)
  32. {
  33. Response.OutputStream.Write(buffer, 0, bytes);
  34. }
  35. }
  36. Response.Flush();
Add Comment
Please, Sign In to add comment