Microsoft Exam Questions

Which of the following configuration settings causes the unanticipated error?

You work as a Web Application Developer for company Inc. The company uses Visual Studio .NET as
its application development platform. You create an ASP.NET Web application using the .NET
Framework. The application is installed in a Network Load Balancing cluster. You are evaluating a
bug statement. When a failure takes place in the Web application, the client occasionally gets an
error page as anticipated. At other times, the client gets an exception stack with the error message,
which is not anticipated. You are required to find out the configuration setting that causes the
unanticipated error. Which of the following configuration settings causes the unanticipated error?

A.
<compilation debug=”true” />

B.
<customErrors mode=”Off” />

C.
<compilation debug=”false” />

D.
<customErrors mode=”On” />

Explanation:
The <customErrors mode=”Off” /> configuration settings causes the unanticipated error. The
<customErrors> element of the Web.config file provides information about custom error messages
for ASP.NET applications. The mode attribute of the <customErrors> element is used to specify
whether custom errors are enabled, disabled, or shown only to remote clients. It is a required
attribute in the <customErrors> element. It can be set to one of the following values:
On: Setting the mode attribute to On enables custom errors for the application.
Off: Setting the mode attribute to Off disables custom errors for the application.
RemoteOnly: It is the default value for the mode attribute. Setting the mode attribute to
RemoteOnly specifies that custom errors will be shown only to remote clients, and ASP.NET errors
will be shown to the local host.
The defaultRedirect attribute of the <customErrors> element is used to specify the default URL to
which a browser will be directed when an error occurs. It is an optional attribute.
Answer C and A are incorrect. The compilation Element is an ASP.NET Settings Schema. It is used to
configure all compilation settings that ASP.NET utilizes to compile applications. In .NET Framework
2.0, the compilers child element of the compilation element is deprecated in support of the
compilers element of the system.codeDom section. Its syntax is as follows:

The debug attribute is an optional boolean attribute of the compilation Element. It specifies whether
to compile debug binaries instead of retail binaries. By default, the debug attribute is set to false.
Answer D is incorrect. The mode attribute of the customErrors Element should be set to “Off”
instead of “On”. Setting the mode attribute to “On” enables custom errors for the application.