J
José Joye
Hello,
I'm currently reading the MS Developing Web applications with c# (and
VB.net).
In the chapter related to Error management, there is a sample about
"Page-Level Error Pages"
eg:
In my form:
========
<%@ Page language="c#" Codebehind="TestErrOnPage.aspx.cs"
AutoEventWireup="false" Inherits="myDummyTry.TestErrOnPage"
errorPage="ErrDefault1.aspx"%>
I have placed a button on the form and in the code behind just thrown an
Exception.
in ErrDefaulst1.aspx:
==============
private void Page_Load(object sender, System.EventArgs e)
{
if (Server.GetLastError() != null)
litError.Text="<h3>" + Server.GetLastError().Message + "</h3>";
else
litError.Text= "<h3>Unkown Error occured...</h3>";
Server.ClearError();
}
It is said, that is is possible to use the Server.GetLastError() in the
error page. However, it is always null.
Did I miss something?
Thanks,
José
I'm currently reading the MS Developing Web applications with c# (and
VB.net).
In the chapter related to Error management, there is a sample about
"Page-Level Error Pages"
eg:
In my form:
========
<%@ Page language="c#" Codebehind="TestErrOnPage.aspx.cs"
AutoEventWireup="false" Inherits="myDummyTry.TestErrOnPage"
errorPage="ErrDefault1.aspx"%>
I have placed a button on the form and in the code behind just thrown an
Exception.
in ErrDefaulst1.aspx:
==============
private void Page_Load(object sender, System.EventArgs e)
{
if (Server.GetLastError() != null)
litError.Text="<h3>" + Server.GetLastError().Message + "</h3>";
else
litError.Text= "<h3>Unkown Error occured...</h3>";
Server.ClearError();
}
It is said, that is is possible to use the Server.GetLastError() in the
error page. However, it is always null.
Did I miss something?
Thanks,
José