Hi all,
In global.asax, in Application_BeginRequest, I have a condition - under this condition I execute SQL stored procedures, I append information and exceptions to a log file and I send email. This is the structure of all:
if (my conditions, including a GET from a local scheduled Windows task to run in the morning)
{
logFile = HttpContext.Current.Server.MapPath("my path here containing the DateTime.Now.ToString bla bla.txt");
StreamWritter sw = new StreamWriter(logFile, true); //so the file is created if it doesn't exist (at the beginning of each month), otherwise appended
sw.WriteLine("{0} : Begin running the job", currentDate.ToString());
try
{
other try-catch-finally, ifs etc
}
catch (Excep ...
Go to the complete details ...