using System;
using System.Web.UI;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ScriptManager1.AllowCustomErrorsRedirect = false;
ScriptManager.GetCurrent(this).RegisterAsyncPostBackControl(Button1);
ScriptManager1.AsyncPostBackError += delegate(object s, AsyncPostBackErrorEventArgs args)
{
Label1.Text = args.Exception.Message;
};
//ScriptManager1.AsyncPostBackError += new EventHandler<System.Web.UI.AsyncPostBackErrorEventArgs>(ScriptManager1_AsyncPostBackError);
}
//protected void ScriptManager1_AsyncPostBackError(object s, AsyncPostBackErrorEventArgs args)
//{
// ScriptManager1.AsyncPostBackErrorMessage = args.Exception.Message;
//}
protected void Button1_Click(object sender, EventArgs e)
{
throw new Exception("エラー発生。");
}
}