Exception Handling In Export to Excel [Resolved]

Posted by kgovindarao523-21772 under C# on 2/3/2014 | Points: 10 | Views : 1753 | Status : [Member] [MVP] | Replies : 2
Hi,
In my Application, I put try-catch blok in export to excel code. In catch block

catch(Exception)
{
Response.Redirect("~/Error.aspx");
}


I am sure, the code doesnt contain any errors.But it always redirects to Error page.

How to resolve this?

Thank you,
Govind



Responses

Posted by: Sravan661 on: 2/3/2014 [Member] Bronze | Points: 50

Up
0
Down

Resolved
Please revert if you have any issues

sravan

kgovindarao523-21772, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sravan661 on: 2/3/2014 [Member] Bronze | Points: 50

Up
0
Down

Resolved
Hi govind,

the Response.End() in Export to excel throws ThreadAbortException so please use the following code set

catch (ThreadAbortException)
{
}
catch (Exception)
{
Response.Redirect("~/Error.aspx");
}
Now it works without any exception

Hope it works

Revert to me if any issues

sravan

kgovindarao523-21772, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response