Torna al Thread
protected void Application_Error(object sender, EventArgs e)
{
m_mutex.WaitOne();
LogError();
m_mutex.ReleaseMutex();
}
protected void LogError()
{
string strPath = Server.MapPath("/errors/") + "log.log";
FileStream fs = File.Open(strPath, FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
Exception ex = Server.GetLastError();
sw.WriteLine(DateTime.Now.ToString() + ": " + ex.Message + " - Error Message: " + ex.InnerException + " - Stack Trace: " + ex.StackTrace + " - User/Browser: " + Request.Browser.Type + ", " + Request.UserAgent + ", " + Request.UserHostAddress + ", " + Request.UserHostName + ", " + Request.UserLanguages[0] + ", " + Request.Url);
sw.Close();
fs.Close();
}