Vb.Net |
Dim e As SmHttpRequestEventArgs=Args(0)'IP白名单 If Proj.ConcurrentDictionary.Count<=0 Then '将IP的集合存放到Proj.ConcurrentDictionary Proj.ConcurrentDictionary.Clear() Dim lst As List(Of String)=Proj.SysDataFactory("UserDB").GetListOfColumnValue("select IpAddress from IpWhiteList") For Each ipAddress As String In lst Proj.ConcurrentDictionary.TryAdd(ipAddress,"") Next End If If Proj.ConcurrentDictionary.Count>0 Then '如果有IP白名单,则认为有需要控制IP访问 Dim strIp As String '如果没有在白名单找到相应的IP,则返回False If Not Proj.ConcurrentDictionary.TryGetValue(e.RemoteAddress,strIp) Then Return False End If End If '中间件如果不想后续程序的执行的话,则必须返回True Return True |
C# |
|