。NET MVC [AllowAnonymous] 跳过授权过滤器

[AllowAnonymous]
        public JsonResult LoaderColumns(JObject data)
        {
            DataTable dt = RunProcedureDataTable(data, "sed_s_smp_man_list");
            if (data["loader"].ToString()== "pinZhong" && data["value"].ToString()!="" && dt.Rows.Count==0)
            {
                ProcInfo pi = new ProcInfo();
                string sql = @"(SELECT VarietyName AS pinZhong,
                                        VarietySource AS zuHe,
                                        JudgementNo AS shenDingBH,
                                        {0} AS cloader
                                 FROM dbo.VarietyApproval
                                 WHERE VarietyName = ‘{1}‘)
                                UNION
                                (SELECT VarietyName AS pinZhong,
                                        VarietySource AS zuHe,
                                        NULL AS shenDingBH,
                                        {0} AS cloader
                                 FROM dbo.VarietyRegistration
                                 WHERE VarietyName = ‘{1}‘)";

                pi.SQL = String.Format(sql, data["loader"].ToString(), data["value"].ToString());
                pi.Type = "sql";
                pi.ConnStr = "bigData";
                DataSet ds= RunProcedureDataSet(data, pi);
                if (ds.Tables[0].Rows.Count != 0)
                {
                    dt = ds.Tables[0];
                }
            }
            //return JsonConvert.SerializeObject(dt);


            return JsonNet(dt);
        }

/// <summary>
    /// 自定义Action过滤器:垃圾回收
    /// </summary>
    [AttributeUsage(AttributeTargets.All, AllowMultiple = true)]//多次调用
    public class CustomDisposeFilter : ActionFilterAttribute
    {
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            //判断是否跳过授权过滤器
            if (filterContext.ActionDescriptor.IsDefined(typeof(AllowAnonymousAttribute), true)
                || filterContext.ActionDescriptor.ControllerDescriptor.IsDefined(typeof(AllowAnonymousAttribute), true))
            {
                return;
            }
            base.OnActionExecuted(filterContext);
            GC.Collect();
        }
    }

。NET MVC [AllowAnonymous] 跳过授权过滤器

上一篇:iOS - 逆向工程


下一篇:Android APK反编译