What should you recommend?

You are designing an ASP.NET Web application that will be deployed both to a server that runs IIS 6 and to a server that runs IIS 7.0.
The Web application must meet the following requirements:
– Log all unhandled exceptions.
– Write exception details to a custom error log.
– When an exception occurs, write the user credentials to a custom error log.
You need to recommend an approach for handling errors.
What should you recommend?

You are designing an ASP.NET Web application that will be deployed both to a server that runs IIS 6 and to a server that runs IIS 7.0.
The Web application must meet the following requirements:
– Log all unhandled exceptions.
– Write exception details to a custom error log.
– When an exception occurs, write the user credentials to a custom error log.
You need to recommend an approach for handling errors.
What should you recommend?

A.
Create an error handler for the Application_Error event.

B.
Create an error handler for the HttpApplication.LogRequest event.

C.
In the customErrors element of the Web.config file, set the mode attribute to On.

D.
In the customErrors element of the Web.config file, set the defaultRedirect attribute to errors.htm.

Explanation:
Using Application_Error
When both MVC applications and traditional ASP.NET applications encounter an exceptio 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 *