Page 119 - DCAP312_WEB_TECHNOLOGIES_II
P. 119

Unit 6: Error Handling



            Under the top level information is the Trace log, which provides details of page life cycle. It   Notes
            provides elapsed time in seconds since the page was initialized.(See Figure 6.1)


                                      Figure 6.1: Trace Information

                              Trace Information
                                  Category
                             aspx.page        Begin PreInit
                             aspx.page        End PreInit
                             aspx.page        Begin Init
                             aspx.page        End Init
                             aspx.page        Begin InitComplete
                             aspx.page        End InitComplet
                             aspx.page        Begin LoadState
                             aspx.page        End LoadState
                             aspx.page        Begin ProcessPostData
                             aspx.page        End ProcessPostData
                             aspx.page        Begin PreLoad
                             aspx.page        End PreLoad
                             aspx.page        Begin Load
                             aspx.page        End Load
                             aspx.page        Begin ProcessPostData Second Try
                             aspx.page        End ProsessPostData Second Try
                             aspx.page        Begin Raise ChangedEvents
                             aspx.page        End Raise ChangedEvents


            The control tree, which lists all controls on the page in a hierarchical manner:

                                        Figure 6.2: Control tree

                             Control Tree
                            Control UniqueID                              Type                          Render size
                            __Page      ASP.default_aspx         2850
                             ctl02      System.Web.UI.LiteralControl  175
                             ctl00      System.Web.UI.HtmlControls.HtmlHead  70
                               ctl01    System.Web.UI.HtmlControls.HtmlTitle  57
                             ctl03      System.Web.UI.LiteralControl  14
                             form1      System.Web.UI.HtmlControls.HtmlForm  2571
                               ctl04    System.Web.UI.LiteralControl  27
                               lblheading  System.Web.UI.WebControl.Label  65
                               ctl05    System.Web.UI.LiteralControl  42
                               ddlquotes  System.Web.UI.WebControl.DropDownlist 570
                               ctl06    System.Web.UI.LiteralControl  42
                               lblquotes  System.Web.UI.WebControl.Label  96
                               ctl07    System.Web.UI.LiteralControl  42
                               HyperLink1  System.Web.UI.WebControl.HyperLink  49
                               ctl08    System.Web.UI.LiteralControl  24
                             ctl09      System.Web.UI.LiteralControl  20

            Last in the Session and Application state summaries, cookies and headers collections, followed
            by list of all server variables.
            The Trace object allows you to add custom information to the trace output. It has two methods
            to accomplish this: the Write method and the Warn method.
            Change the Page_Load event handler to check the Write method:

            protected void Page_Load(object sender, EventArgs e)
                      {
                      Trace.Write( “Page Load”);
                      if (!IsPostBack)
                      {
                      Trace.Write( “Not Post Back, Page Load”);
                      string[,] quotes

                                             LOVELY PROFESSIONAL UNIVERSITY                                   113
   114   115   116   117   118   119   120   121   122   123   124