try
{
int _quarterId = 0;
if (id != null)
{
_quarterId = (int)id;
}
else
{
_quarterId = Utility.GetQuarterIdFromSession();
}
int _businessId = Utility.GetBusinessIdFromSession();
if (_quarterId > 0 && _businessId > 0)
{
Return _return = _engineService.GetFormPdf(_quarterId, _businessId);
if (_return != null && _return.FormPDF != null &&
_return.FormPDF.Length > 0)
{
Response.Clear();
Response.Buffer = false;
Response.AddHeader("Accept-Header", _return.FormPDF.Length.ToString());
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment; filename= FormPdf.pdf");
Response.AddHeader("content-length", _return.FormPDF.Length.ToString());
Response.BinaryWrite(_return.FormPDF);
Response.Flush();
}
}
}
catch (ThreadAbortException)
{
}
//This sets empty content and avoids the exception in changing the HTTP header
return new EmptyResult();
}