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