IPSecurity restrictions in IIS 6

I made a reference to the IISOle.dll and used the following code to add restrictions.  It requires .NET 3.5.   You can use Visual Basic Express to compile the code.  Thanks Brent for the assistance!

Imports System.DirectoryServices
Module Module1

    Sub Main(ByVal v_arrArgs As String())

        Dim args() As String = Environment.GetCommandLineArgs
        Dim y As Integer
        For y = 1 To UBound(args)
    End Sub

    Sub ProcessIT(ByVal value As String)
        Dim ServerIP As String
        Dim IPAddress As String
        Dim SiteID As String
        Dim arrSplit As String() = Nothing

        arrSplit = value.Split(CType(“!”, Char))
        ServerIP = arrSplit(0)
        IPAddress = arrSplit(1)
        SiteID = arrSplit(2)
        Dim Dir As New DirectoryEntry(“IIS://” & ServerIP & “/W3SVC/” & SiteID & “/ROOT”)
        Dim IpSec As IISOle.IPSecurity = Dir.Properties(“IPSecurity”).Value
        IpSec.GrantByDefault = True
        Dim IpList = (From Ip As String In CType(IpSec.IPDeny, Object())).ToList()

        For Each item As String In IpList
    End Sub

End Module

Here is a forum post.



Steve Schofield

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: