BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.Security.Permissions.CodeAccessSecurityAttribute System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.All, AllowMultiple=true, Inherited=false) System.Runtime.InteropServices.ComVisible(true)

The following example shows a declarative request for full access to the specified file. The security action indicates that this is the minimum permission required for the target assembly to be able to execute.

[assembly:FileIOPermissionAttribute(SecurityAction.RequestMinimum, All="\\example\\sample.txt")]

The following example shows how to demand that the calling code has unrestricted access to files and directories. Demands are typically made to protect methods or classes from malicious code.

[FileIOPermissionAttribute(SecurityAction.Demand, Unrestricted=true)]

Files and directories are specified using absolute paths. When accessing files, a security check is performed when the file is created or opened. The security check is not done again unless the file is closed and reopened. Checking permissions when the file is first accessed minimizes the impact of the security check on application performance because opening a file happens only once, while reading and writing can happen multiple times.

The scope of the declaration that is allowed depends on the that is used.

The security information declared by a security attribute is stored in the metadata of the attribute target and is accessed by the system at run time. Security attributes are used only for declarative security. For imperative security, use the corresponding permission class.

Unrestricted grants permission for all paths within a file system, including multiple pathnames that can be used to access a single given file. To access to a file, you must Deny all possible paths to the file. For example, if \\server\share is mapped to the network drive X, to Deny access to \\server\share\file, you must Deny \\server\share\file, X:\file and any other path that you can use to access the file.

Allows security actions for to be applied to code using declarative security. This class cannot be inherited.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  To be added.
  is not a valid value.

  Initializes a new instance of the class with the specified .

  One of the values.
  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Obsolete("use newer properties")
  System.String To be added.

  This property sets access for a single file or directory. Use additional attributes to specify additional files and directories.

  Gets or sets full access for the file or directory that is specified by the string value.

- Property
  2.0.0.0
  4.0.0.0
  System.Security.Permissions.FileIOPermissionAccess To be added.

  This property gets or sets the permitted access to all files on the local computer and network drives.

  An individual value can be determined by using a bitwise AND operation.

  Gets or sets the permitted access to all files.

- Property
  2.0.0.0
  4.0.0.0
  System.Security.Permissions.FileIOPermissionAccess To be added.

  Local files are files contained on the local computer. Any files that are not accessed through a network drive are local files.

  An individual value can be determined by using a bitwise AND operation.

  Gets or sets the permitted access to all local files.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the absolute path of the file or directory for which append access is secured.

  The path information specified for a set operation contains invalid characters or wild card specifiers.

  This property sets access for a single file or directory. Use additional attributes to specify additional files and directories.

  Gets or sets append access for the file or directory that is specified by the string value.

  0
- Property
  2.0.0.0
  4.0.0.0
  System.String To be added.

  This property gets or sets access for a single file or directory. Use additional attributes to specify additional files and directories.

  An access control list (ACL) describes individuals or groups who have, or do not have, rights to specific actions on the given file and its properties. The ability to change an ACL is an important permission and should be granted with caution.

  Gets or sets the file or directory in which access control information can be changed.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Security.IPermission

  This method should be called only by the security system, never by application code.

  At compile time, attributes convert security declarations to a serialized form in metadata. Declarative security data in metadata is created from the permission that this method returns that corresponds to this attribute.

  Creates and returns a new .

  A that corresponds to this attribute.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the absolute path of the file or directory for which access to the contents of the path is secured.

  The path information specified for a set operation contains invalid characters or wild card specifiers.

  Path discovery controls access to the information in the path itself. This helps protect sensitive information in the path, such as user names, as well as information about the directory structure revealed in the path. This value does not grant access to files or folders represented by the path.

  For performance reasons, should be granted only to directories, not to files. For example, permission should be granted to paths such as C:\test and C:\test\, not to files such as C:\test\example.txt.

  This property sets access for a single file or directory. Use additional attributes to specify additional files and directories.

  Gets or sets the file or directory to which to grant path discovery.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the absolute path of the file or directory for which read access is secured.

  The path information specified for a set operation contains invalid characters or wild card specifiers.

  This property sets access for a single file or directory. Use additional attributes to specify additional files and directories.

  Gets or sets read access for the file or directory specified by the string value.

  0
- Property
  2.0.0.0
  4.0.0.0
  System.String To be added.

  This property gets or sets access for a single file or directory. Use additional attributes to specify additional files and directories.

  An access control list (ACL) describes individuals or groups who have, or do not have, rights to specific actions on the given file and its properties. The ability to view an ACL is an important permission and should be granted with caution.

  Gets or sets the file or directory in which access control information can be viewed.

- Property
  2.0.0.0
  4.0.0.0
  System.String To be added.

  This property sets the , , , and properties for a single file or directory. Use additional attributes to specify additional files and directories. The access rights are for file data only; they do not include the access control properties and .

  The get accessor is provided for C# compiler compatibility. The C# compiler requires attribute properties to be read/write.

  Gets or sets the file or directory in which file data can be viewed and modified.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the absolute path of the file or directory for which write access is secured.

  The path information specified for a set operation contains invalid characters or wild card specifiers.

  This property sets access for a single file or directory. Use additional attributes to specify additional files and directories.

  Gets or sets write access for the file or directory specified by the string value.

  0
0