We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Thread was being aborted

Thread ID:

Created:

Updated:

Platform:

Replies:

44298 May 19,2006 12:01 PM UTC May 22,2006 12:44 PM UTC WinForms 1
loading
Tags: PDF
Abhishek
Asked On May 19, 2006 12:01 PM UTC

Hello SyncFusion Support, I am running a small stress test on a small asp.net app developed using sync fusion lib. I get this exception at each call. Thread was being aborted.. at System.Threading.Thread.AbortInternal() at System.Threading.Thread.Abort(Object stateInfo) at System.Web.HttpResponse.End() at Syncfusion.Pdf.PDFDocument.Save(String fileName, HttpResponse response, HttpReadType type) at _Default.GeneratePDF() in c:\Inetpub\wwwroot\SyncFusionPrototype\Default.aspx.cs:line 62 at _Default.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\SyncFusionPrototype\Default.aspx.cs:line 19. My code is very simple .... PDFDocument pdfDoc = new PDFDocument(); pdfDoc.Margins = new PDFPadding(0); pdfDoc.LastPage.Orientation = PageOrientation.Landscape; // Bug is SyncFusion library prevents it from re-using images //System.Drawing.Image img = Cache["Image1"] as System.Drawing.Image; System.Drawing.Image img = System.Drawing.Image.FromFile(@"C:\test\certificate Body A4 Landscape.JPG"); pdfDoc.LastPage.Graphics.DrawWatermark(img, WatermarkImageType.Stretched); IPDFFont pdfFont = pdfDoc.Fonts.Add(new System.Drawing.Font("Arial", 10)); pdfFont.Size = 10; string[] lines = (string[])Cache["text"]; pdfDoc.LastPage.Graphics.DrawMultiText(321, 182, pdfDoc.LastPage.DrawingWidth, pdfDoc.LastPage.DrawingHeight, string.Format(lines[0], 12345), pdfFont); pdfDoc.LastPage.Graphics.DrawMultiText(260, 255, pdfDoc.LastPage.DrawingWidth, pdfDoc.LastPage.DrawingHeight, string.Format(lines[1], "Bangalore", "India", "02/02/2004"), pdfFont); pdfDoc.Save("Sample.pdf", Response, HttpReadType.Open); pdfDoc.Dispose(); pdfDoc = null; ------------------------

Ajish [Syncfusion]
Replied On May 22, 2006 12:44 PM UTC

Hi Abishek, Sorry for the delay in getting back to you. I tested the above issue with the code given by you, but I was unable to reproduce the issue. It may be caused if you use the Response.End, Response.Redirect, or Server.Transfer method, a ThreadAbortException exception can occurs. Try to use a try-catch statement to catch this exception. The Response.End method ends the page execution and shifts the execution to the Application_EndRequest event in the application''s event pipeline. The line of code that follows Response.End is not executed that’s why this exception is thrown. To work around this problem, use one of the following methods: - For Response.End, call the HttpContext.Current.ApplicationInstance.CompleteRequest method instead of Response.End to bypass the code execution to the Application_EndRequest event. - For Response.Redirect, use an overload, Response.Redirect(String url, bool endResponse) that passes false for the endResponse parameter to suppress the internal call to Response.End. For example: Response.Redirect ("nextpage.aspx", false); If you use this workaround, the code that follows Response.Redirect is executed. - For Server.Transfer, use the Server.Execute method instead. I hope this would solve the issue. Please try this and let me know if you have any further questions. Also here is the test sample that I used: Sample. Thanks, Ajish.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;