System.UnauthorizedAccessException Class

public class UnauthorizedAccessException : SystemException

Base Types

Object
  Exception
    SystemException
      UnauthorizedAccessException

Assembly

mscorlib

Library

BCL

Summary

Represents the error that occurs when an I/O operation cannot be performed because of incompatible file access levels.

Description

UnauthorizedAccessException is typically thrown when a request is made to write to a read-only file, or a file I/O operation is requested on a directory.

See Also

System Namespace

Members

UnauthorizedAccessException Constructors

UnauthorizedAccessException() Constructor
UnauthorizedAccessException(System.String) Constructor
UnauthorizedAccessException(System.String, System.Exception) Constructor


UnauthorizedAccessException() Constructor

public UnauthorizedAccessException();

Summary

Constructs and initializes a new instance of the UnauthorizedAccessException class.

Description

This constructor initializes the System.UnauthorizedAccessException.Message property of the new instance to a system-supplied message that describes the error, such as "Attempted to perform an unauthorized operation." This message takes into account the current system culture.

The System.UnauthorizedAccessException.InnerException property of the new instance is initialized to null .

See Also

System.UnauthorizedAccessException Class, System Namespace

UnauthorizedAccessException(System.String) Constructor

public UnauthorizedAccessException(string message);

Summary

Constructs and initializes a new instance of the UnauthorizedAccessException class.

Parameters

message
A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.

Description

This constructor initializes the System.UnauthorizedAccessException.Message property of the new instance using message. If message is null , the System.UnauthorizedAccessException.Message property is initialized to the system-supplied message provided by the constructor that takes no arguments.

The System.UnauthorizedAccessException.InnerException property of the new instance is initialized to null .

See Also

System.UnauthorizedAccessException Class, System Namespace

UnauthorizedAccessException(System.String, System.Exception) Constructor

public UnauthorizedAccessException(string message, Exception inner);

Summary

Constructs and initializes a new instance of the UnauthorizedAccessException class.

Parameters

message
A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
inner
An instance of Exception that is the cause of the current exception. If inner is non-null, then the current Exception was raised in a catch block handling inner.

Description

This constructor initializes the System.UnauthorizedAccessException.Message property of the new instance using message and the System.UnauthorizedAccessException.InnerException property using inner. If message is null , the System.UnauthorizedAccessException.Message property is initialized to the system-supplied message provided by the constructor that takes no arguments.

[Note: For more information on inner exceptions, see System.Exception.InnerException.]

See Also

System.UnauthorizedAccessException Class, System Namespace