PrepAway - Latest Free Exam Questions & Answers

What should you do?

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.
void Application_Error(object sender, EventArgs e)
{
Response.Redirect(“~/Error.aspx”);
}

D.
Add the following code segment to the Global.asax file.
void Page_Error(object sender, EventArgs e)
{
Server.Transfer(“~/Error.aspx”);
}


Leave a Reply