我试过了:
if (pdfDocumentinBytes!= null)
{
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = "application/pdf";
Response.AppendHeader("Content", "attachment; filename=" + this.documentName + ".pdf");
Response.BinaryWrite(pdfDocumentinBytes);
Response.End();
}
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "fancyboxClose();", true);
fancyboxClose()
是一个函数,它只是在从服务器端调用时关闭花式框。