code_junkie

IIS is keeping hold of my generated files

Nov 10th, 2011
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. byte[] asciiBytes = getPdf(...);
  2. try{
  3. BinaryWriter bw = new BinaryWriter(File.Create(filename));
  4. bw.Write(pdfBytes);
  5. }
  6. finally {
  7. if(null != bw)
  8. bw.Close();
  9. }
  10.  
  11. Response.ContentType = "application/pdf";
  12. Response.AppendHeader("Content-disposition", "attachment; filename=" + PDID + ".pdf");
  13. Response.WriteFile(filename);
  14. Response.Flush();
Add Comment
Please, Sign In to add comment