Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 1st, 2012  |  syntax: None  |  size: 0.48 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Passing through an ASPX file to get a file on a server ? (Webforms)
  2. Response.Clear();
  3. Response.ContentType = "application/octet-stream";
  4. Response.HeaderEncoding = Response.ContentEncoding;
  5.  
  6. Response.AppendHeader("content-disposition",
  7.     String.Format(CultureInfo.InvariantCulture,
  8.     "attachment; filename="{0}"", yourFileName));
  9. Response.AppendHeader("content-length",
  10.     yourFileSize.ToString(CultureInfo.InvariantCulture));
  11.  
  12. Response.TransmitFile(yourFilePath);
  13. Response.End();