Tuesday, 28 October 2014

ERROR HANDLING /RUNTIME DEBUGING

Every web application unlike desktop application needs effective error handling because web is involved with
http, web servers, database servers, security servers etc..,ASP .NET being server side technology for web
applications provides plenty of support to debug an application the concepts of ASP.NET that supports these
are.
     1. Exception handling using trycatche.
     2. Page level errors using “Page_error event”.
     3. Web.config custom errors.
     4. Application _error event of Global.asax file.
     5. Debug class and debug windows (F11, F10).
     6. Tracing.
1. Try cache: is called as method or statement level error handling.
Ex: right click in the code view and select snippet then Try.
           {
             Cache (Exception)
            }
{
           Response. Write (“invalid action performed”);
           }
            Finally { }
NOTE: this is a statement level error handling.
       -all the code should start with try cache.
2. Pagelevel Errors using Page_error event
   The Page_error fires when the statements in the page or not handled for errors.
   Protected Void_Error (Object s, EventArgs e)
// Code gets fire when some statements of this page raise an error and that are not handler.


3. Web.Config Errors:
   -go to web.config and try this then only in the local system only we get the errors not in the client systems.
    To reduce the load on the web page and to get a better performance.
    <Custom errors mode=”Local only”>
Write in “web.config“
Web.config errors
       Mode= when “ON” Errors are handled local and remote.
            = When “OFF” Errors are handled but remote only.
        Ex:
           <Custom Errors mode=”ON” default redirect=”~/Error Page.html”/>
Default Redirected=<Programme>
The page i.e. served when a runtime error occurs and when it is not handled by below levels.
<Custom errors mode=”ON” default>

No comments:

Post a Comment