locked
Global Exception Handling RRS feed

  • Question

  • User-1078128378 posted

    Hi All,

    I have an existing project, it is in asp.net web forms

    in that project every event (page_load,button_click,dropdown_selectionIndexChanged etc.....) is calling in between try catch block like below

    protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                checkLogin();
                //some logic
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message + "<br />" + ex.StackTrace, 1);
            }
        }

    in existing project we are just showing exception message to the users.

    Now i want to log all exception messages in a log file( i can able to write log files)

    but in my project we have many number of web pages and every page having many events, so for logging each and every catch block in all events is to much time consuming and i need to write the log code in all catch blocks in all pages.

    so is there any option to globally write log message for all try catch events in all pages.

    it would be more helpful to me

    Thanks,

    Sunday, April 29, 2018 1:30 PM

All replies