Execute all methods or none if error occurs in any one method in ASP.Net

Last Reply on Jan 14, 2014 12:34 AM By Mudassar

Posted on Jan 14, 2014 12:33 AM

I have a method which perform following task

1.save file to a folder

2.save data to database

3.send email to client

I want if any exception occur then non of  them will work.

currently it save file  even if there is some exception in databse connection or sending email. Which make my folder heavy.

Posted on Jan 14, 2014 12:34 AM

There is no automatic way of doing this if for example some error occurs in Database i.e. Step to you will have to write code to delete the file