日期:2014-05-17  浏览次数:20424 次

构造函数不执行,求教!!!
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
    public class myAuthorize : AuthorizeAttribute
    {
        private readonly bool _authorize;
        private bool _isPermissionFail = false;
        public myAuthorize() {
            string test = "断点";//在这里设置断点,F5调试时,并未进入这一步
            if (HttpContext.Current.User.Identity.Name != "")
            {
                _authorize = true;
            }
            else
            {
                _authorize = false;
            }
        }
        public myAuthorize(string permission)
        {
            string test = "断点";//在这里设置断点,,F5调试时,并未进入这一步
            if (HttpContext.Current.User.Identity.Name != "")
            {
               
                _authorize = PermissionManager.CheckUserHasPermision(HttpContext.Current.User.Identity.Name, permission);
                if (_authorize == false)
                {
                    _isPermissionFail = true;
                }
            }
            else
            {
                _authorize = false;
            }
        }
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            return _authorize;
        }
        public override void OnAuthorization(AuthorizationContext filterContext)
 &n