当前位置:首页 > Web开发 > 正文

MVC Exception Filter

2024-03-31 Web开发

GlobalFilters.Filters.Add(new ExceptionFilter());


public class ExceptionFilter:IExceptionFilter { public void OnException(ExceptionContext filterContext) { Exception ex = filterContext.Exception; string path= filterContext.HttpContext.Server.MapPath("/"); File.AppendAllText(path,ex.ToString(),System.Text.Encoding.Default); } }

MVC Exception Filter

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/42799.html