Exemple #1
0
        protected void Application_Error(object sender, EventArgs e)
        {
            Exception lastException = Server.GetLastError();
            //log by reading lastException.Message

            string           actionName = Request.Path;
            Error            error      = new Error();
            ErrorsController ec         = new ErrorsController();

            error.errorValue = ec.LogError(User.Identity.Name, lastException, "", actionName);
            db.Errors.Add(error);
            db.SaveChanges();
            Server.ClearError();
            Response.Redirect("\\Error.html");
        }