Free Support Forum - aspose.com

Thread was being aborted

I need to catch all exceptions in my programm and write it into log file.
I have found that when I open PDF file in browser
using pdf.Save(Response) function the following exception is always generated:
“Thread was being aborted”. Note, that file is opening correctly.

I tried to to insert logging into your example and received the same result.
Here is my changes in your Northwind.aspx.cs:

try
{
pdf.Save(Response);
Response.End();
}
catch (Exception eReport)
{
StreamWriter LogFile = null;
LogFile = new StreamWriter(“c:\log.txt”, true);
LogFile.WriteLine(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " " + eReport.Message);
LogFile.Close();
}

Please, comment.

Dear spt,

Thanks for your consideration.

I have traced into the code and found that the exception was thrown when the Response.End() is called. So this exception has nothing to do with Aspose.Pdf. Maybe it’s a normal thing when Response.End() is called.