Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created October 22, 2015 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/5b3b1e6ab1ec5593b7a5 to your computer and use it in GitHub Desktop.
Save bjoerntx/5b3b1e6ab1ec5593b7a5 to your computer and use it in GitHub Desktop.
protected void Page_Load(object sender, EventArgs e)
{
// execute only when loaded from IFRAME
if (Request.QueryString["download"] == "1")
{
if (Session["document"] == null)
return;
// return the stored document
Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition",
"attachment; filename=results.pdf");
Response.BinaryWrite((byte[])Session["document"]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment