With this class, you can ensure that the current process has the required code access security permission to access the SQL Server provider before you attempt to open a connection. If it doesn’t, a System.Security.SecurityException will be thrown. You can also use this class to programmatically revoke the permission to access the SQL Server provider for the current method call.

This class pertains only to code access security (the policy of allowed and disallowed actions you have configured using the .NET Framework Configuration Tool or the caspol.exe command-line utility). It has nothing to do with the authentication process SQL Server uses. For more information, refer to the reference for the base class System.Data.Common.DBDataPermission. Currently, the only code access security restriction you can apply to the SQL Server data provider is denying permission to use blank passwords in the connection string.

public sealed class SqlClientPermission : System.Data.Common.DBDataPermission {

// Public Constructors

   public SqlClientPermission( );  

   public SqlClientPermission(System.Security.Permissions.PermissionState state);

   public SqlClientPermission(System.Security.Permissions.PermissionState state, bool allowBlankPassword);

// Public Instance Methods

   public override void Add(string connectionString, string restrictions, System.Data.KeyRestrictionBehavior behavior);          

                  // overrides System.Data.Common.DBDataPermission

   public override IPermission Copy( );                         // ...

Get ADO.NET in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.