PrepAway - Latest Free Exam Questions & Answers

You need to display the Error.aspx page if an unhandled error occurs on any page within the site

You are implementing an ASP.NET Web site. The root directory of the site contains a page named
Error.aspx. You need to display the Error.aspx page if an unhandled error occurs on any page within
the site. You also must ensure that the original URL in the browser is not changed. What should you
do?

PrepAway - Latest Free Exam Questions & Answers

A.
Add the following configuration to the web.config file.
<system.web>
<customErrors mode=”On”>
<error statusCode=”500″ redirect=”~/Error.aspx” />
</customErrors>
</system.web>

B.
Add the following configuration to the web.config file.
<system.web>
<customErrors redirectMode=”ResponseRewrite”
mode=”On” defaultRedirect=”~/Error.aspx” />
</system.web>

C.
Add the following code segment to the Global.asax file.
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Response.Redirect(“~/Error.aspx”)
End Sub

D.
Add the following code segment to the Global.asax file.
Protected Sub Page_Load(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Me.Load
Server.Transfer(“~/Error.aspx”)

End Sub


Leave a Reply