|
-
June 30th, 2009, 02:51 AM
#1
System.Threading.ThreadAbortException Error and Response.End
Hi, I encounter the error when i use response.end for display my report.
After refer to http://support.microsoft.com/default...b;en-us;312629 , i have change response.end to HttpContext.Current.ApplicationInstance.CompleteRequest() or remove the code, i do not encounter the error anymore but my report is not displayed.
Does anyone has any idea on this ?
my code is as below:
Code:
rptDataSource = GetRptSource(sEmployeeList, sLeaveType, sFrDate, sToDate)
ReportViewer1.LocalReport.DataSources.Add(rptDataSource)
ReportViewer1.LocalReport.EnableExternalImages = True
ReportViewer1.LocalReport.Refresh()
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim streams As String() = Nothing
Dim extension As String = Nothing
Dim warnings As Microsoft.Reporting.WebForms.Warning() = Nothing
Dim returnValue As Byte()
' Call the Render Method To Deliver the Report With Out Preview
returnValue = ReportViewer1.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streams, warnings)
Response.Buffer = True
Response.Clear()
Response.ContentType = "Application/pdf"
Response.AddHeader("content-disposition", "inline; filename=apr." + extension)
Response.BinaryWrite(returnValue)
Response.Flush()
'Response.End()
-
June 30th, 2009, 03:11 AM
#2
Re: System.Threading.ThreadAbortException Error and Response.End
Change your code to try/catch block
(C# syntax)
Code:
try{
//your code here
}
catch(ThreadAbortException)
{
//ignore, cause by the Repsone.End
}
catch(Exception e){
//do something with untwanted exceptions
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|