Which of the following actions will you perform to accomplish the task?

You work as a Web Application Developer for SunInfo Inc. The company uses Visual Studio 2008 as
its application development platform. You create a Web application using .NET Framework 3.5. You
want to redirect users to a default error page if an unhandled error occurs within your site. Which of
the following actions will you perform to accomplish the task?

You work as a Web Application Developer for SunInfo Inc. The company uses Visual Studio 2008 as
its application development platform. You create a Web application using .NET Framework 3.5. You
want to redirect users to a default error page if an unhandled error occurs within your site. Which of
the following actions will you perform to accomplish the task?

A.
Set the mode attribute of the customErrors element to On and the defaultRedirect attribute to an
error page within your site.

B.
Set the redirect attribute of the error element to an error page within your site.

C.
Set the statusCode attribute of the error element to 404 and the redirect attribute to a custom
error page.

D.
Set the mode attribute of the customErrors element to Off and the defaultRedirect attribute to an
error page within your site.

Explanation:
You can use the <customErrors> element nested inside <system.web> to configure custom errors in
the Web.config file. The <customErrors> element has a mode attribute that can be set to On to turn
custom errors on and a defaultRedirect attribute that can be set to the path to a default error page.

Answer D is incorrect. The mode attribute of the <customErrors> element is set to Off, which
indicates that custom errors are disabled. The detailed ASP.NET error page will be shown to the
users.

Answer B is incorrect. The <error> element nested inside the <customErrors> element defines an
error-specific custom page.

Answer C is incorrect. The statusCode of the <error> element is set to 404, which indicates that if a
file is not found at the requested URL, the user is redirected to a custom error page specified by the
redirect attribute.



Leave a Reply 0

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