1 protected override void OnStartProcessingRequest(ProcessRequestArgs args) 2 { 3 string ipAddress = HttpContext.Current.Request.UserHostAddress; 4 ManagerEntities entity = new ManagerEntities(); 5 var result = (from p in entity.ClientIPLists 6 where (p.IP == ipAddress && p.Allow) || (p.IP == "255.255.255.255" && p.Allow) 7 select p).Count(); 8 if (result == 0) 9 throw new System.Exception(string.Format("当前IP{0}未经授权!")); 10 base.OnStartProcessingRequest(args); 11 }
浙公网安备 33010602011771号