Hi Amit,
Thank you for using Syncfusion Products.
We are internally using httpresponse to save or open the document in browser as follow
if (fileName == null)
{
throw new ArgumentNullException("fileName");
}
if (response == null)
{
throw new ArgumentNullException("response");
}
response.ClearContent();
response.Expires = 0;
response.Buffer = true;
string disposition = "content-disposition";
if (type == HttpReadType.Open)
{
response.AddHeader(disposition, "inline; filename=" + fileName);
}
else if (type == HttpReadType.Save)
{
response.AddHeader(disposition, "attachment; filename=" + fileName);
}
response.AddHeader("Content-Type", "application/pdf");
response.Clear();
Save(response.OutputStream);
if (PdfDocumentBase.IsSecurityGranted)
{
response.Flush();
response.End();
}
else
{
response.End();
}
So the thread exception occurs when end the response. But is not an issue, it is an actual behaviour you can refer the following link
http://msdn.microsoft.com/en-us/library/system.web.httpresponse.end.aspx
when end response it tries to raise the thredabortexception so it is not an issue it an actual behavior of Microsoft “HttpResponse.End”.
Please let us know if you need any further assistance.
Regards,
Karthikeyan.C
Hi Amit,
Thank you for using Syncfusion Products.
We are internally using httpresponse to save or open the document in browser as follow
if (fileName == null)
{
throw new ArgumentNullException("fileName");
}
if (response == null)
{
throw new ArgumentNullException("response");
}
response.ClearContent();
response.Expires = 0;
response.Buffer = true;
string disposition = "content-disposition";
if (type == HttpReadType.Open)
{
response.AddHeader(disposition, "inline; filename=" + fileName);
}
else if (type == HttpReadType.Save)
{
response.AddHeader(disposition, "attachment; filename=" + fileName);
}
response.AddHeader("Content-Type", "application/pdf");
response.Clear();
Save(response.OutputStream);
if (PdfDocumentBase.IsSecurityGranted)
{
response.Flush();
response.End();
}
else
{
response.End();
}
So the thread exception occurs when end the response. But is not an issue, it is an actual behaviour you can refer the following link
http://msdn.microsoft.com/en-us/library/system.web.httpresponse.end.aspx
when end response it tries to raise the thredabortexception so it is not an issue it an actual behavior of Microsoft “HttpResponse.End”.
Please let us know if you need any further assistance.
Regards,
Karthikeyan.C
Hi Karthikeyan,
I have done the changes that you had suggested, But still I am facing the same issue. And it is working fine on my local machine but on server report is not getting generated. It may be the problem of compiled code because server use compiled code.
WordDocument wordDoc = new WordDocument();
rfpWordReports = new RFPQuoteSlipReports();
rfpWordReports.GenerateReports(orm, wordDoc);
DocToPDFConverter converter = new DocToPDFConverter();
string fileName = @"RFPQuoteSlip_" + UserContext.TenantName.ToString() + ".pdf";
PdfDocument pdfDoc = converter.ConvertToPDF(wordDoc);
pdfDoc.Save(fileName, Response, HttpReadType.Save);
After change the "HttpReadType.Open" with "HttpReadType.Save". Problem is being still persists.
So please help us ASAP...
Environment Detail:
Server 2008 R2 for web
Windows Server 2012 for SQL Server
Thanks
Nishant Garg
Hi Nishant,
Please use the below method to save the PDF document to avoid this exception.
protected void PdfSave(PdfDocument pdfDoc, HttpResponse response)
{
//File name to save as PDF
string fileName = "Sample.pdf";
if (fileName == null)
{
throw new ArgumentNullException("fileName");
}
if (response == null)
{
throw new ArgumentNullException("response");
}
response.ClearContent();
response.Expires = 0;
response.Buffer = true;
string disposition = "content-disposition";
//To open within Browser
if (CheckBox1.Checked)
{
response.AddHeader(disposition, "inline; filename=" + fileName);
}
//To download as attachment
else
{
response.AddHeader(disposition, "attachment; filename=" + fileName);
}
response.AddHeader("Content-Type", "application/pdf");
response.Clear();
//Saving the PDF document
pdfDoc.Save(response.OutputStream);
response.Flush();
}
Regards,
Karthikeyan.C