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?

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?

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

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

C.
Add the following code segment to the Global.asaxfile.
void Application_Error(object sender, EventArgs e)
{
Response.Redirect(“~/Error.aspx”);
}

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



Leave a Reply 0

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