1、.net core 中获取
public override void OnActionExecuted(ActionExecutedContext context) { var descriptor = (Microsoft.AspNetCore.Mvc.Controllers.ControllerActionDescriptor)context.ActionDescriptor; if (descriptor.MethodInfo.ReturnType.Name.ToLower() == "actionresult") { //写自己的逻辑 } base.OnActionExecuted(context); }
descriptor.MethodInfo.ReturnType.Name 及时action返回的类型 ,如 ActionResult JsonResult 等等