<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="Default"%>
Exceptions at work
To test this page effectively, first disable the customErrors section in the web.config file and
then try again with the section enabled.
File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default : System.Web.UI.Page
{
protected void Page_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex is NotImplementedException)
Server.Transfer("/notimplementedexception.aspx");
else
Server.Transfer("/apperror.aspx");
Server.ClearError();
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
throw new NotImplementedException("The feature you requested is not implemented yet.");
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
string test = null;
Response.Write(test.ToString());
}
}