Wednesday, June 22, 2022

Try and Catch with WriteException for log and other exception for alert in C# ASP.NET

try

{

}

catch (FileNotFoundException ex)

            {

                ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Nothing to download');", true);

            }

            catch (IOException ex)

            {

                ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Nothing to download');", true);

            }

            catch (Exception ex)

            {

                ExceptionHandler.WriteException(ex.Message);

            }

No comments:

Post a Comment