AppDomain.Evidence プロパティ
セキュリティ ポリシーに情報として提供される、アプリケーション ドメインに関連付けられている Evidence を取得します。
Public Overridable ReadOnly Property Evidence As Evidence _ Implements _AppDomain.Evidence Implements _ IEvidenceFactory.Evidence
[C#]
public virtual Evidence Evidence {get;}
[C++]
public: __property virtual Evidence* get_Evidence();
[JScript]
public function get Evidence() : Evidence;
プロパティ値
セキュリティ ポリシーに情報として提供される、アプリケーション ドメインに関連付けられている Evidence を取得します。
実装
例外
例外の種類 | 条件 |
---|---|
AppDomainUnloadedException | 操作が、アンロードされたアプリケーション ドメインで試行されています。 |
SecurityException | 呼び出し元に、必要なアクセス許可がありません。 |
使用例
Imports System
Imports System.Reflection
Imports System.Security.Policy 'for evidence object
Imports System.Security 'for securityzone object
Imports System.Collections 'for IEnumerator
Class ADCreateDomain
Public Shared Sub Main()
' Create appdomainsetup information for new appdomain.
Dim domaininfo As New AppDomainSetup()
domaininfo.ApplicationBase = "file:///" + System.Environment.CurrentDirectory
domaininfo.ConfigurationFile = "file:///" + System.Environment.CurrentDirectory + "ADCreateDomain.exe.config"
domaininfo.ApplicationName = "MyApplication"
domaininfo.LicenseFile = "file:///" + System.Environment.CurrentDirectory + "license.txt"
'Create evidence for the new appdomain.
Dim adevidence As Evidence = AppDomain.CurrentDomain.Evidence
'Add the zone and url information to restrict permissions assigned to the appdomain.
adevidence.AddHost(New Url("http://www.site.com"))
adevidence.AddHost(New Zone(SecurityZone.Internet))
' Create the application domain.
Dim newDomain As AppDomain = AppDomain.CreateDomain("MyDomain", adevidence, domaininfo)
' Write out the application domain information.
Console.WriteLine(("Host domain: " + AppDomain.CurrentDomain.FriendlyName))
Console.WriteLine(("child domain: " + newDomain.FriendlyName))
Console.WriteLine()
Console.WriteLine(("Application base is: " + newDomain.SetupInformation.ApplicationBase))
Console.WriteLine(("Configuration file is: " + newDomain.SetupInformation.ConfigurationFile))
Console.WriteLine(("Application name is: " + newDomain.SetupInformation.ApplicationName))
Console.WriteLine(("License file is: " + newDomain.SetupInformation.LicenseFile))
Dim newevidenceenum As IEnumerator = newDomain.Evidence.GetEnumerator()
While newevidenceenum.MoveNext()
Console.WriteLine(newevidenceenum.Current)
End While
AppDomain.Unload(newDomain)
End Sub 'Main
End Class 'ADCreateDomain
[C#]
using System;
using System.Reflection;
using System.Security.Policy; //for evidence object
using System.Security; //for securityzone object
using System.Collections; //for IEnumerator
class ADCreateDomain
{
public static void Main()
{
// Create appdomainsetup information for the new appdomain.
AppDomainSetup domaininfo = new AppDomainSetup();
domaininfo.ApplicationBase = "file:///" + System.Environment.CurrentDirectory;
domaininfo.ConfigurationFile = "file:///" + System.Environment.CurrentDirectory + "ADCreateDomain.exe.config";
domaininfo.ApplicationName = "MyApplication";
domaininfo.LicenseFile = "file:///" + System.Environment.CurrentDirectory + "license.txt";
//Create evidence for new appdomain.
Evidence adevidence = AppDomain.CurrentDomain.Evidence;
//Add the zone and url information to restrict permissions assigned to the appdomain.
adevidence.AddHost(new Url("http://www.site.com"));
adevidence.AddHost(new Zone(SecurityZone.Internet));
// Create the application domain.
AppDomain newDomain = AppDomain.CreateDomain("MyDomain", adevidence, domaininfo);
// Write out the application domain information.
Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName);
Console.WriteLine("child domain: " + newDomain.FriendlyName);
Console.WriteLine();
Console.WriteLine("Application base is: " + newDomain.SetupInformation.ApplicationBase);
Console.WriteLine("Configuration file is: " + newDomain.SetupInformation.ConfigurationFile);
Console.WriteLine("Application name is: " + newDomain.SetupInformation.ApplicationName);
Console.WriteLine("License file is: " + newDomain.SetupInformation.LicenseFile);
IEnumerator newevidenceenum = newDomain.Evidence.GetEnumerator();
while(newevidenceenum.MoveNext())
Console.WriteLine(newevidenceenum.Current);
AppDomain.Unload(newDomain);
}
}
[C++]
#using <mscorlib.dll>
using namespace System;
using namespace System::Reflection;
using namespace System::Security::Policy; //for evidence object
using namespace System::Security; //for securityzone object
using namespace System::Collections; //for IEnumerator
int main()
{
// Create appdomainsetup information for the new appdomain.
AppDomainSetup* domaininfo = new AppDomainSetup();
domaininfo->ApplicationBase = String::Format( S"file:///{0}", System::Environment::CurrentDirectory );
domaininfo->ConfigurationFile = String::Format( S"file:///{0}ADCreateDomain.exe.config", System::Environment::CurrentDirectory );
domaininfo->ApplicationName = S"MyApplication";
domaininfo->LicenseFile = String::Format( S"file:///{0}license.txt", System::Environment::CurrentDirectory );
//Create evidence for new appdomain.
Evidence* adevidence = AppDomain::CurrentDomain->Evidence;
//Add the zone and url information to restrict permissions assigned to the appdomain.
adevidence->AddHost(new Url(S"http://www.site.com"));
adevidence->AddHost(new Zone(SecurityZone::Internet));
// Create the application domain.
AppDomain* newDomain = AppDomain::CreateDomain(S"MyDomain", adevidence, domaininfo);
// Write out the application domain information.
Console::WriteLine(S"Host domain: {0}", AppDomain::CurrentDomain->FriendlyName);
Console::WriteLine(S"child domain: {0}", newDomain->FriendlyName);
Console::WriteLine();
Console::WriteLine(S"Application base is: {0}", newDomain->SetupInformation->ApplicationBase);
Console::WriteLine(S"Configuration file is: {0}", newDomain->SetupInformation->ConfigurationFile);
Console::WriteLine(S"Application name is: {0}", newDomain->SetupInformation->ApplicationName);
Console::WriteLine(S"License file is: {0}", newDomain->SetupInformation->LicenseFile);
IEnumerator* newevidenceenum = newDomain->Evidence->GetEnumerator();
while(newevidenceenum->MoveNext())
Console::WriteLine(newevidenceenum->Current);
AppDomain::Unload(newDomain);
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
.NET Framework セキュリティ:
- SecurityPermission (証拠が指定されたアセンブリを読み込むために必要なアクセス許可)。 SecurityPermissionFlag.ControlEvidence (関連する列挙体)