public override void OnActionExecuting(ActionExecutingContext filterContext) { if (!ImmediateDelete) { BackgroundGAC.SetBusy(); base.OnActionExecuting(filterContext); } }
public override void OnResultExecuted(ResultExecutedContext filterContext) { if (ImmediateDelete) { var result = filterContext.Result as FilePathResult; if (result != null) { string fileName = result.FileName; if (System.IO.File.Exists(fileName)) { filterContext.HttpContext.Response.Flush(); filterContext.HttpContext.Response.End(); try { System.IO.File.Delete(fileName); } catch (Exception) { } } } } else { base.OnResultExecuted(filterContext); BackgroundGAC.SetFree(); } }