WebPermission Class : WebPermission « Network Remote « VB.Net






WebPermission Class

 

Imports System.Text.RegularExpressions
Imports System.Net

Imports System.Collections
Imports System.Collections.Generic


Module Example
    Public Sub Main()

        Dim myRegex As New Regex("http://www\.domain\.com/.*")

        Dim myWebPermission As New WebPermission(NetworkAccess.Connect, myRegex)
        myWebPermission.AddPermission(NetworkAccess.Connect, "http://www.domain.com")
        myWebPermission.AddPermission(NetworkAccess.Accept, "http://www.domainA.com/")
        myWebPermission.Demand()

        Dim myConnectEnum As IEnumerator = myWebPermission.ConnectList
        While myConnectEnum.MoveNext()
            Console.WriteLine((ControlChars.Tab + myConnectEnum.Current.ToString()))
        End While
    End Sub
End Module

   
  








Related examples in the same category

1.Get all the URIs with Accept permission
2.Create WebPermission with the access rights for the specified URI regular expression.
3.Create WebPermission class with the access rights for the specified URI.
4.Create WebPermission that passes all demands or fails all demands.
5.WebPermission.AcceptList Property returns accept permissions
6.Adds URI with the access rights to the current WebPermission.
7.Adds URI string with the specified access rights to the current WebPermission.
8.WebPermission.FromXml creates a WebPermission from an XML encoding.
9.WebPermission.Intersect returns intersection of two WebPermission instances.
10.WebPermission.IsSubsetOf determines whether the current WebPermission is a subset of the specified object.
11.WebPermission.Union Method returns union between two instances of the WebPermission class.