国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

ADSI+ASP添加IP到IIS禁止訪問列表中

2024-05-04 11:00:31
字體:
來源:轉載
供稿:網友
復制代碼 代碼如下:
<%@ Language=VBScript %>
<%
Dim strIP
strIP = request("IP")
%>
<FORM action=? method=post>
輸入IP:<input type=text value="<%=strIP%>" style="BORDER: #AAAAAA 1px solid;" name="IP">
<input type="submit" value="確定發送">
</FORM>
<%
if strIP="list" then
Call ListDenyIP("2443")
response.end
end if
if strIP="query" then
Call CheckWebSiteSetup
response.end
end if
#
if strIP<>"" then
Call AddDenyIP("2443",strIP)
end if
Sub CheckWebSiteSetup()
Set IISOBJ=GetObject("IIS://LocalHost/W3SVC")
for each website in IISOBJ
if website.Class="IIsWebServer" then
for each b in website.ServerBindings
response.write ("Server "&Website.AdsPath" has binding"&b)
response.write ("<br>")
next
end if
next
end sub
#
Sub ListDenyIP(strWebNo)
set SecObj = GETObject("IIS://LocalHost/W3SVC/"+strWebNo+"/Root")
set MyIPSec = SecObj.IPSecurity
IPList=MyIPSec.IPDeny
if ubound(IPList)<0 then
response.write "<BR>無數據,請先隨便加一條<BR>"
exit sub
end if
#
intIPListCount=ubound(IPList)+1
#
for i=0 to ubound(IPList)
response.write i+1
response.write ":"
response.write IPList(i)
response.write "<br>"
next
end sub
Sub AddDenyIP(strWebNo,strDenyIp)
set SecObj = GETObject("IIS://LocalHost/W3SVC/"+strWebNo+"/Root")
set MyIPSec = SecObj.IPSecurity
' Make sure GrantByDefault=TRUE or your changes will not count.
If (FALSE = MyIPSec.GrantByDefault) Then
Response.Write "<BR>GrantByDefault was not TRUE. Setting to TRUE.<BR>"
MyIPSec.GrantByDefault = TRUE
End If

IPList=MyIPSec.IPDeny
if ubound(IPList)<0 then
response.write "<BR>無數據,請先隨便加一條<BR>"
exit sub
end if
#
intIPListCount=ubound(IPList)+1
#
for i=0 to ubound(IPList)
if strDenyIp = left(IPList(i),len(strDenyIp)) then
response.write "<BR>重復數據。<BR>"
exit sub
end if
next
redim Preserve IPList(intIPListCount)
IPList(intIPListCount)=strDenyIp

response.write "新添加:"
response.write strDenyIp
response.write "<br>"
MyIPSec.IPDeny = IPList
SecObj.IPSecurity = MyIPSec
SecObj.Setinfo
end sub
%>

您可能感興趣的文章:

ASP.net做的IP訪問限制用ASP代碼實現對IP的訪問限制的代碼Asp下實現限制IP訪問的程序代碼用asp腳本實現限制IP訪問推薦的用Asp實現屏蔽IP地址訪問的代碼記錄游客頁面訪問IP的簡易實現代碼 (asp.net+txt)通過ASP禁止指定IP和只允許指定IP訪問網站的代碼Asp限制IP訪問 阻止某一個IP段禁止訪問本站的代碼asp實現限制一個ip只能訪問一次的方法
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 桑日县| 呼伦贝尔市| 二连浩特市| 荣成市| 永登县| 赤壁市| 虞城县| 永仁县| 苗栗市| 灯塔市| 韩城市| 滨州市| 沙田区| 霍林郭勒市| 灵石县| 黄平县| 剑河县| 瑞昌市| 三河市| 临洮县| 东源县| 华池县| 安乡县| 张家川| 佛冈县| 白玉县| 新宾| 慈溪市| 靖江市| 丰城市| 伊川县| 陇川县| 长治市| 桓台县| 屏南县| 河池市| 印江| 容城县| 岫岩| 民勤县| 定州市|