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         }

 

posted on 2013-06-20 14:13  leagiboy  阅读(703)  评论(0)    收藏  举报