Hi,
You can have a text file in your project and then you can write dynamic code in Application_Error function of global.asax.So any error at any page happens anytime will go to this section and written to text file.
void Application_Error(object sender, EventArgs e)
{
Exception ex = new Exception();
ex = Server.GetLastError().GetBaseException();
System.IO.FileStream fs = new System.IO.FileStream(Server.MapPath("~/error.txt"), System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);
System.IO.StreamWriter s = new System.IO.StreamWriter(fs);
s.BaseStream.Seek(0, System.IO.SeekOrigin.End);
s.WriteLine("MESSAGE: " + ex.Message + "\nSOURCE: " + ex.Source + "\nFORM: " + Request.Form.ToString() + "\nQUERYSTRING: " + Request.QueryString.ToString() + "\nTARGETSITE: " + ex.TargetSite.ToString() + "\nSTACKTRACE: " + ex.StackTrace + System.Diagnostics.EventLogEntryType.Error);
s.WriteLine("--------------------------------------------------------");
s.Close();
}
Hope this will help you.
Thanks,
Sanjay
Laghaterohan, if this helps please login to Mark As Answer. | Alert Moderator