zoukankan      html  css  js  c++  java
  • .net mvc 获取acion 返回类型

    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  等等

    
    
    
    
  • 相关阅读:
    第四章5
    第四章4
    第四章3
    第四章2
    第四章1
    第四章例4-8
    第四章例4-7
    第四章例4-6
    第四章例4-5
    第四章例4-4
  • 原文地址:https://www.cnblogs.com/Zing/p/10521503.html
Copyright © 2011-2022 走看看