SecurityException 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
보안 오류가 검색될 때 throw되는 예외입니다.
public ref class SecurityException : Exception
public ref class SecurityException : SystemException
public class SecurityException : Exception
[System.Serializable]
public class SecurityException : SystemException
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class SecurityException : SystemException
public class SecurityException : SystemException
type SecurityException = class
inherit Exception
[<System.Serializable>]
type SecurityException = class
inherit SystemException
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type SecurityException = class
inherit SystemException
type SecurityException = class
inherit SystemException
Public Class SecurityException
Inherits Exception
Public Class SecurityException
Inherits SystemException
- 상속
- 상속
- 특성
설명
SecurityException 호출자에게 리소스에 액세스하는 데 필요한 권한이 없는 경우 예외가 throw됩니다. 다음 예제에서는 UI 개체 및 클립보드에 대한 액세스를 허용하는 개체와 레지스트리 액세스를 방지하기 위해 개체를 포함하는 UIPermission 개체를 RegistryPermission 인스턴스화 PermissionSet 합니다. 메서드에 PermissionSet.PermitOnly 대한 호출은 호출자에게 할당된 사용 권한에 관계없이 이러한 사용 권한이 적용됨을 의미합니다. 결과적으로 레지스트리 키를 만들려는 시도는 .를 SecurityExceptionthrow합니다.
using Microsoft.Win32;
using System;
using System.Security;
using System.Security.Permissions;
public class Example
{
public static void Main()
{
PermissionSet perms = new PermissionSet(null);
perms.AddPermission(new UIPermission(PermissionState.Unrestricted));
perms.AddPermission(new RegistryPermission(PermissionState.None));
perms.PermitOnly();
try {
RegistryKey key = Registry.CurrentUser.CreateSubKey("MyCompany\\Applications");
Console.WriteLine("Registry key: {0}", key.Name);
}
catch (SecurityException e) {
Console.WriteLine("Security Exception:\n\n{0}", e.Message);
}
}
}
// The example displays the following output:
// Security Exception:
//
// Request for the permission of type 'System.Security.Permissions.RegistryPermission,
// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Imports Microsoft.Win32
Imports System.Security
Imports System.Security.Permissions
Module Example
Public Sub Main()
Dim perms As New PermissionSet(CType(Nothing, PermissionSet))
perms.AddPermission(New UIPermission(PermissionState.Unrestricted))
perms.AddPermission(New RegistryPermission(PermissionState.None))
perms.PermitOnly()
Try
Dim key As RegistryKey = Registry.CurrentUser.CreateSubKey("MyCompany\\Applications")
Console.WriteLine("Registry key: {0}", key.Name)
Catch e As SecurityException
Console.WriteLine("Security Exception:\n\n{0}", e.Message)
End Try
End Sub
End Module
' The example displays the following output:
' Security Exception:
'
' Request for the permission of type 'System.Security.Permissions.RegistryPermission,
' mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
SecurityException 는 값이 0x8013150A HRESULT COR_E_SECURITY 사용합니다.
클래스 인스턴스 SecurityException 의 초기 속성 값 목록은 특정 SecurityException 생성자를 참조하세요.
생성자
| Name | Description |
|---|---|
| SecurityException() |
기본 속성을 사용하여 클래스의 새 인스턴스를 SecurityException 초기화합니다. |
| SecurityException(SerializationInfo, StreamingContext) |
직렬화된 데이터를 사용하여 클래스의 새 인스턴스를 SecurityException 초기화합니다. |
| SecurityException(String, AssemblyName, PermissionSet, PermissionSet, MethodInfo, SecurityAction, Object, IPermission, Evidence) |
권한 부여 집합이 부족하여 발생하는 예외에 대한 클래스의 SecurityException 새 인스턴스를 초기화합니다. |
| SecurityException(String, Exception) |
지정된 오류 메시지와 이 예외의 SecurityException 원인인 내부 예외에 대한 참조를 사용하여 클래스의 새 인스턴스를 초기화합니다. |
| SecurityException(String, Object, Object, MethodInfo, Object, IPermission) |
스택에서 거부로 인한 예외에 대한 클래스의 SecurityException 새 인스턴스를 초기화합니다. |
| SecurityException(String, Type, String) |
지정된 오류 메시지, 예외를 throw한 사용 권한 유형 및 사용 권한 상태를 사용하여 클래스의 새 인스턴스 SecurityException 를 초기화합니다. |
| SecurityException(String, Type) |
지정된 오류 메시지와 예외가 SecurityException throw된 사용 권한 유형을 사용하여 클래스의 새 인스턴스를 초기화합니다. |
| SecurityException(String) |
지정된 오류 메시지를 사용하여 클래스의 SecurityException 새 인스턴스를 초기화합니다. |
속성
| Name | Description |
|---|---|
| Action |
예외를 발생시킨 보안 동작을 가져오거나 설정합니다. |
| Data |
예외에 대한 추가 사용자 정의 정보를 제공하는 키/값 쌍의 컬렉션을 가져옵니다. (다음에서 상속됨 Exception) |
| Demanded |
실패한 요청된 보안 권한, 권한 집합 또는 사용 권한 집합 컬렉션을 가져오거나 설정합니다. |
| DenySetInstance |
요청이 실패하게 한 거부된 보안 권한, 권한 집합 또는 사용 권한 집합 컬렉션을 가져오거나 설정합니다. |
| FailedAssemblyInfo |
실패한 어셈블리에 대한 정보를 가져오거나 설정합니다. |
| FirstPermissionThatFailed |
요청이 실패한 사용 권한 집합 또는 사용 권한 집합 컬렉션의 첫 번째 권한을 가져오거나 설정합니다. |
| GrantedSet |
를 발생 SecurityException시킨 어셈블리의 부여된 사용 권한 집합을 가져오거나 설정합니다. |
| HelpLink |
이 예외와 연결된 도움말 파일에 대한 링크를 가져오거나 설정합니다. (다음에서 상속됨 Exception) |
| HResult |
특정 예외에 할당된 코딩된 숫자 값인 HRESULT를 가져오거나 설정합니다. (다음에서 상속됨 Exception) |
| InnerException |
현재 예외를 Exception 발생시킨 인스턴스를 가져옵니다. (다음에서 상속됨 Exception) |
| Message |
현재 예외를 설명하는 메시지를 가져옵니다. (다음에서 상속됨 Exception) |
| Method |
예외와 연결된 메서드에 대한 정보를 가져오거나 설정합니다. |
| PermissionState |
예외를 throw한 사용 권한의 상태를 가져오거나 설정합니다. |
| PermissionType |
실패한 사용 권한의 형식을 가져오거나 설정합니다. |
| PermitOnlySetInstance |
보안 검사가 실패하게 한 허용 전용 스택 프레임의 일부인 사용 권한, 사용 권한 집합 또는 사용 권한 집합 컬렉션을 가져오거나 설정합니다. |
| RefusedSet |
를 발생 SecurityException시킨 어셈블리의 거부된 사용 권한 집합을 가져오거나 설정합니다. |
| Source |
오류를 발생시키는 애플리케이션 또는 개체의 이름을 가져오거나 설정합니다. (다음에서 상속됨 Exception) |
| StackTrace |
호출 스택에서 직접 실행 프레임의 문자열 표현을 가져옵니다. (다음에서 상속됨 Exception) |
| TargetSite |
현재 예외를 throw하는 메서드를 가져옵니다. (다음에서 상속됨 Exception) |
| Url |
예외를 발생시킨 어셈블리의 URL을 가져오거나 설정합니다. |
| Zone |
예외를 발생시킨 어셈블리의 영역을 가져오거나 설정합니다. |
메서드
| Name | Description |
|---|---|
| Equals(Object) |
지정한 개체와 현재 개체가 같은지 여부를 확인합니다. (다음에서 상속됨 Object) |
| GetBaseException() |
파생 클래스에서 재정의되는 경우 하나 이상의 후속 예외의 근본 원인인 값을 반환 Exception 합니다. (다음에서 상속됨 Exception) |
| GetHashCode() |
기본 해시 함수로 작동합니다. (다음에서 상속됨 Object) |
| GetObjectData(SerializationInfo, StreamingContext) |
에 SerializationInfo 대한 SecurityExceptionwith 정보를 설정합니다. |
| GetType() |
현재 인스턴스의 런타임 형식을 가져옵니다. (다음에서 상속됨 Exception) |
| MemberwiseClone() |
현재 Object단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| ToString() |
현재 SecurityException.의 표현을 반환합니다. |
이벤트
| Name | Description |
|---|---|
| SerializeObjectState |
예외에 대한 직렬화된 데이터를 포함하는 예외 상태 개체를 만들기 위해 예외가 serialize될 때 발생합니다. (다음에서 상속됨 Exception) |