B
Brian Munroe
Let me preface this post: This is my first web app in ASP.NET, I am
sure I did things very kludgy, so please bare with my possibly stupid
ASP.NET design.
I am trying to create a custom error page that starts the process of
logging the bug via a web form. I capture things like contact name,
time, date, etc plus the stack trace, error message and error source
The problem I am having is that everytime I cause an error, I keep
getting a generic System.Web.HttpUnhandledException message.
I configured the global.asax file like the following:
<script language="C#" runat="server">
protected void Application_Error(Object sender, EventArgs e) {
Exception lastException = Server.GetLastError();
if(lastException != null) {
Session["ErrorStack"] = lastException.StackTrace;
Session["ErrorSource"] = lastException.Source;
Session["ErrorMessage"] = lastException.Message;
}
Server.Transfer("error.aspx");
}
</script>
The event below is what I am testing on. SaveDailyEntryFormData2 is a
static method in a code-behind class. It basically inserts a new
record into a database and returns a string of "saved" if the record
was inserted correctly.
void Submit_Click(object sender, ImageClickEventArgs e) {
string yo = SaveDailyEntryFormData2(Request);
if (yo == "saved") {
Server.Transfer("daily.entry2.aspx");
} else {
Response.Write(yo);
}
}
I am artificially creating an error by passing an empty value in one of
the Request parameters, causing a poorly formed SQL query, and thus
causing an error message.
The standard ASP.NET error message page actually shows me the trace
inside of my code-behind and is actually very helpful in identifying
problems, but when I try and use my custom error code page, the
exception thrown is the very generic (HttpUnhandledException)
SaveDailyEntryFormData2 does not have any try/catch blocks and I am
wondering if that could be my problem?
thanks
-- brian
sure I did things very kludgy, so please bare with my possibly stupid
ASP.NET design.
I am trying to create a custom error page that starts the process of
logging the bug via a web form. I capture things like contact name,
time, date, etc plus the stack trace, error message and error source
The problem I am having is that everytime I cause an error, I keep
getting a generic System.Web.HttpUnhandledException message.
I configured the global.asax file like the following:
<script language="C#" runat="server">
protected void Application_Error(Object sender, EventArgs e) {
Exception lastException = Server.GetLastError();
if(lastException != null) {
Session["ErrorStack"] = lastException.StackTrace;
Session["ErrorSource"] = lastException.Source;
Session["ErrorMessage"] = lastException.Message;
}
Server.Transfer("error.aspx");
}
</script>
The event below is what I am testing on. SaveDailyEntryFormData2 is a
static method in a code-behind class. It basically inserts a new
record into a database and returns a string of "saved" if the record
was inserted correctly.
void Submit_Click(object sender, ImageClickEventArgs e) {
string yo = SaveDailyEntryFormData2(Request);
if (yo == "saved") {
Server.Transfer("daily.entry2.aspx");
} else {
Response.Write(yo);
}
}
I am artificially creating an error by passing an empty value in one of
the Request parameters, causing a poorly formed SQL query, and thus
causing an error message.
The standard ASP.NET error message page actually shows me the trace
inside of my code-behind and is actually very helpful in identifying
problems, but when I try and use my custom error code page, the
exception thrown is the very generic (HttpUnhandledException)
SaveDailyEntryFormData2 does not have any try/catch blocks and I am
wondering if that could be my problem?
thanks
-- brian