Handling Errors

Quando ocorre um erro numa pagina. o ASP.NET envia informação sobre o erro para o cliente. Os erros são divididos em 4 categorias:

  • Configuration errors: Occur when the syntax or structure of a Web.config file in the configuration hierarchy is incorrect.
  • Parser errors: Occur when the ASP.NET syntax on a page is malformed.
  • Compilation errors: Occur when statements in a page’s target language are incorrrect.
  • Run-time errors: Occur during a page’s execution, even though the errors could not be detected at compile time.

By default, the information shown for a run-time error is the call stack (the chains of procedure calls leading up to the exception). If debug mode is enabled, ASP.NET displays the line number in source code where the run-time error originated. Debug mode is a valuable tool for debugging your application. You can enable debug mode at the page level, using the following directive:

>

Note: Running debug mode incurs a heavy performance penalty. Be sure to disable it before deploying your finished application.
Depending on the circumstances, you might want to handle application errors in different ways. For example, at development time you probably want to see the detailed error pages that ASP.NET provides to help you identify and fix problems. However, once an application is being served in a production environment, you probably do not want to display detailed errors to your customer clients. You can use ASP.NET to specify whether errors are shown to local clients, to remote clients, or to both. By default, errors are shown only to local clients (those clients on the same computer as the server). You can also specify a custom error page to redirect clients to if an error occurs.

---------
artigo completo aqui

					
					

Deixe um comentário

O seu endereço de email não será publicado. Campos obrigatórios marcados com *