コード例 #1
0
        public bool?Validate(HttpRequest request)
        {
            IPAddress_v4 ip = IPAddress_v4.TryCreate(request.UserHostAddress);

            if (ip == null)
            {
                return(null);
            }

            if (this.IPAddresses.Contains(ip) == true)
            {
                return(false);
            }
            return(null);
        }
コード例 #2
0
ファイル: IPAddressCondition.cs プロジェクト: youye00/higlabo
        public Boolean?Validate(HttpRequest request)
        {
            var          req = request;
            IPAddress_v4 ip  = IPAddress_v4.TryCreate(req.UserHostAddress);

            if (ip == null)
            {
                return(null);
            }

            if (this.Start.Value <= ip.Value && ip.Value <= this.End.Value)
            {
                return(this.Allow);
            }
            return(!this.Allow);
        }