Which approach should you recommend?

You need to design an exception-handling strategy for the Web application.
Which approach should you recommend?

You need to design an exception-handling strategy for the Web application.
Which approach should you recommend?

A.
Add a customErrors section in the configuration file, with mode=”On” and defaultRedirect=”/error.aspx”.

B.
Add a customErrors section in the configuration file, with mode=”RemoteOnly” and defaultRedirect=”/
error.aspx”.

C.
Catch all unhandled exceptions in the Page_Error event of each page, send an e-mail message containing
the exception details, clear all errors, and redirect the user to a generic error page.
D. Catch all unhandled exceptions in the Application_Error event of the Global.asax file, send an e- mail
message containing the exception details, clear allerrors, and redirect the user to a generic error page.

Explanation:
When both MVC applications and traditional ASP.NET applications encounter an exception that is not handled
at the page level, they call the Application_Error method in the Global.asax file. Application_Error is the perfect
place for logging information about errors that occur within a production web application so that you can
troubleshoot them later.



Leave a Reply 0

Your email address will not be published. Required fields are marked *