adsi+asp add IP to IIS Prohibit access list _ Application Tips

Source: Internet
Author: User
Copy Code code as follows:

<%@ Language=vbscript%>
<%
Dim StrIP
StrIP = Request ("IP")
%>
<form action=? Method=post>
Enter Ip:<input type=text value= "<%=strIP%>" style= BORDER: #AAAAAA 1px solid; "Name=" IP >
<input type= "Submit" value= "OK send" >
</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> No data, please add a free <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 would not count.
If (FALSE = myipsec.grantbydefault) Then
Response.Write "<br>grantbydefault is not TRUE. Setting to True.<br> "
MyIPSec.GrantByDefault = TRUE
End If

Iplist=myipsec.ipdeny
If UBound (iplist) <0 Then
Response.Write "<BR> No data, please add a free <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> duplicate data. <BR> "
Exit Sub
End If
Next
ReDim Preserve IPList (Intiplistcount)
IPList (Intiplistcount) =strdenyip

Response.Write "New Add:"
Response.Write Strdenyip
Response.Write "<br>"
Myipsec.ipdeny = IPList
Secobj.ipsecurity = MyIPSec
Secobj.setinfo
End Sub
%>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.