P
Patrick Nolan
I am using the following code from Microsoft's support site :
public void Page_Error(object sender,EventArgs e)
{
Exception objErr = Server.GetLastError().GetBaseException();
string err = "<b>Error Caught in Page_Error event</b><hr><br>" +
"<br><b>Error in: </b>" + Request.Url.ToString() +
"<br><b>Error Message: </b>" + objErr.Message.ToString()+
"<br><b>Stack Trace:</b><br>" + objErr.StackTrace.ToString();
Response.Write(err.ToString());
Server.ClearError();
}
but when I run my program
I get :
Object reference not set to an instance of an object.
with the "Exception objErr = Server.GetLastError().GetBaseException();" line
highlighted.
I also tried putting this line above the objErr initialization:
Exception objErr = new Exception();
But I get the same error.
Any ideas would be apprectiated.
Thanks,
Patrick
(e-mail address removed)
public void Page_Error(object sender,EventArgs e)
{
Exception objErr = Server.GetLastError().GetBaseException();
string err = "<b>Error Caught in Page_Error event</b><hr><br>" +
"<br><b>Error in: </b>" + Request.Url.ToString() +
"<br><b>Error Message: </b>" + objErr.Message.ToString()+
"<br><b>Stack Trace:</b><br>" + objErr.StackTrace.ToString();
Response.Write(err.ToString());
Server.ClearError();
}
but when I run my program
I get :
Object reference not set to an instance of an object.
with the "Exception objErr = Server.GetLastError().GetBaseException();" line
highlighted.
I also tried putting this line above the objErr initialization:
Exception objErr = new Exception();
But I get the same error.
Any ideas would be apprectiated.
Thanks,
Patrick
(e-mail address removed)