i just want to show error details with getlasterror object.
here is my web config code to redirect custom error page :
<customErrors mode="On" defaultRedirect="Error.aspx"/>
and here is my Error.aspx page code to catch error :
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;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
public partial class Error : newManageClass
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
LoadError(Server.GetLastError());
}
}
protected void LoadError(Exception objError)
{
if (objError != null)
{
StringBuilder lasterror = new StringBuilder();
if (objError.Source != null)
{
//lasterror.AppendLine("Source:");
//lasterror.AppendLine(objError.Source);
//lasterror.AppendLine();
lbl_from_page.Text = objError.Source.ToString();
}
if (objError.Message != null)
{
//lasterror.AppendLine("Message:");
//lasterror.AppendLine(objError.Message);
//lasterror.AppendLine();
lbl_errormessage.Text = objError.Message.ToString();
}
//if (objError.InnerException != null)
//{
// lasterror.AppendLine("StackTrace:");
// lasterror.AppendLine(objError.StackTrace);
// lasterror.AppendLine();
// lbl_error_desc.Text = objError.InnerException.ToString();
//}
ViewState.Add("LastError", lasterror.ToString());
}
}
}
how ever i can not get details from which page with full url and error message.
please help me...