Compartir a través de


IWMSIPList.Add (Visual Basic .NET)

The Add method adds an IWMSIPEntryIWMSIPEntry Object (Visual Basic .NET) to the IWMSIPList collection.

IWMSIPEntry = IWMSIPist.Add(szAddr, szMask)

Property Value

An IWMSIPEntry object.

Arguments

szAddr

[in] String containing an IP address in decimal notation.

szMask

[in] String containing a mask used to determine whether the first parameter specifies a single IP address or a range of IP addresses. The default value is 255.255.255.255, indicating that the first parameter represents a single IP address.

Remarks

When the address, which is specified by the IWMSIPEntry.Address property, refers to a valid IPv6 address the mask must be set to a single numeric value representing the IPv6 prefix length. For example if the IP address is 3FFE:5000::1, the mask might be set to 127. When the address refers to a valid IPv4 address, the mask must be set using decimal notation. The server treats the mask as a 32-bit value. Each bit in the mask is compared to the corresponding bit in the IP address. When the bit value in the mask is 1, the corresponding bit in the IP address is included in the list. When the bit value in the mask is 0, any value is included. For example if the IP address in the list is 134.123.123.20 and the mask is 255.255.255.0 (that is, the bit fields are 11111111 11111111 11111111 00000000), all IP addresses from 134.123.123.0 to 134.123.123.255 are included in the list. For more information, see the IWMSIPEntry.Mask property.

Example

Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices

Private Sub AddIP()

    ' Declare variables.
    Dim Server As WMSServer
    Dim Plugin As IWMSPlugin
    Dim IPAdmin As IWMSIPAdmin
    Dim IPList As IWMSIPList
    Dim IPEntry As IWMSIPEntry

Try
    ' Create the WMSServer object.
    Server = New WMSServer()

    ' Retrieve the plug-in to be configured.
    Plugin = Server.EventHandlers.Item("WMS IP Address Authorization")

    ' Retrieve the custom interface of the plug-in.
    IPAdmin = Plugin.CustomInterface

    ' Retrieve the list of banned IP addresses.
    IPList = IPAdmin.DisallowIP

    ' Add an IP to the list of banned addresses.
    ' Setting the mask in this case bans all IP addresses
    ' in the range of 128.117.93.*
    IPEntry = IPList.Add("128.117.93.5", "255.255.255.0")

Catch excCom As COMException
    ' TODO: Handle COM exceptions.
Catch exc As Exception
    ' TODO: Handle errors.
Finally
    ' TODO: Clean-up code goes here.
End Try

End Sub

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Reference

IWMSIPList Object (Visual Basic .NET)

IWMSIPList.Remove (Visual Basic .NET)