Permissions
In my description of the namespaces System.Security (in Volume 1 of the .NET Framework Standard Library Annotated Reference) and System.Security.Permissions, I discussed the nature of permissions and the fact that they could be granted either programmatically or declaratively. The System.Net namespace contains three permission objects relating to network programming, each appearing in both programmatic and declarative flavors. The programmatic classes all derive from System.Security.CodeAccessPermission, and the declarative classes from System.Security.CodeAccessSecurityAttribute. The NetworkAccess enumeration is used by the WebPermission and SocketPermission classes, specifying if the program is allowed to accept incoming connections or make outgoing connections or both. The permissions are listed in Figure.
Permission Class | Attribute Class | Controls Access to |
|---|
WebPermission | WebPermissionAttribute | Using WebRequest class | DnsPermission | DnsPermissionAttribute | Domain name servers | SocketPermission | SocketPermissionAttribute | Socket connections |
|