This documentation is archived and is not being maintained.

NetworkInformationPermission.Access Property

Gets the level of access to network information controlled by this permission.

Namespace: System.Net.NetworkInformation
Assembly: System (in system.dll)

public NetworkInformationAccess Access { get; }
/** @property */
public NetworkInformationAccess get_Access ()

public function get Access () : NetworkInformationAccess

Not applicable.

Property Value

One of the NetworkInformationAccess values.

A NetworkInformationPermission created with PermissionState.Unrestricted is given Ping | Read access. A NetworkInformationPermission created with PermissionState.None is given None access.

The following code example creates a NetworkInformationPermission, adds a NetworkInformationAccess value to it, and displays the value of this property.

System.Net.NetworkInformation.NetworkInformationPermission permission = 
    new System.Net.NetworkInformation.NetworkInformationPermission(
        System.Security.Permissions.PermissionState.None);
permission.AddPermission(
        System.Net.NetworkInformation.NetworkInformationAccess.Read);
Console.WriteLine("Access is {0}", permission.Access);

System.Net.NetworkInformation.NetworkInformationPermission permission 
    = new System.Net.NetworkInformation.NetworkInformationPermission(
    System.Security.Permissions.PermissionState.None);
permission.AddPermission(System.Net.NetworkInformation.
    NetworkInformationAccess.Read);
Console.WriteLine("Access is {0}", permission.get_Access());

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Show: