B
Burak Gunay
Hello,
I have a piece of code where I am writing the contents of a datagrid to
an excel report
Dim tw As New StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Dim frm As HtmlForm = New HtmlForm()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition",
"attachment;filename=Test.xls")
Response.Charset = ""
EnableViewState = False
Controls.Add(frm)
frm.Controls.Add(grid2)
frm.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()
it works fine.
In debug mode, after I closed down the excel report and exited the
program, I saw the following message in the debug window
"A first chance exception of type
'System.Threading.ThreadAbortException' occurred in mscorlib.dll
An exception of type 'System.Threading.ThreadAbortException' occurred
in mscorlib.dll but was not handled in user code
The program '[1368] WebDev.WebServer.EXE: Managed' has exited with code
0 (0x0)."
I looked at msdn
http://msdn.microsoft.com/library/?...emthreadingthreadabortexceptionclasstopic.asp
and put a try-catch block around the code to ctach ThreadAbortException
but this time it came back with a "page can not have 2 forms error".
The program works fine. Is this a serious issue? Do I need to catch
this exception? It seems like catching it actually mad ethings worse.
Thanks,
Burak
I have a piece of code where I am writing the contents of a datagrid to
an excel report
Dim tw As New StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Dim frm As HtmlForm = New HtmlForm()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition",
"attachment;filename=Test.xls")
Response.Charset = ""
EnableViewState = False
Controls.Add(frm)
frm.Controls.Add(grid2)
frm.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()
it works fine.
In debug mode, after I closed down the excel report and exited the
program, I saw the following message in the debug window
"A first chance exception of type
'System.Threading.ThreadAbortException' occurred in mscorlib.dll
An exception of type 'System.Threading.ThreadAbortException' occurred
in mscorlib.dll but was not handled in user code
The program '[1368] WebDev.WebServer.EXE: Managed' has exited with code
0 (0x0)."
I looked at msdn
http://msdn.microsoft.com/library/?...emthreadingthreadabortexceptionclasstopic.asp
and put a try-catch block around the code to ctach ThreadAbortException
but this time it came back with a "page can not have 2 forms error".
The program works fine. Is this a serious issue? Do I need to catch
this exception? It seems like catching it actually mad ethings worse.
Thanks,
Burak