AppDomainSetup.ApplicationBase AppDomainSetup.ApplicationBase AppDomainSetup.ApplicationBase AppDomainSetup.ApplicationBase Property

Definizione

Ottiene o imposta il nome della directory contenente l'applicazione.Gets or sets the name of the directory containing the application.

public:
 property System::String ^ ApplicationBase { System::String ^ get(); void set(System::String ^ value); };
public string ApplicationBase { get; set; }
member this.ApplicationBase : string with get, set
Public Property ApplicationBase As String

Valore della proprietà

Nome della directory della base dell'applicazione.The name of the application base directory.

Implementazioni

Esempi

Nell'esempio seguente viene illustrato come utilizzare il ApplicationBase proprietà per impostare il percorso in cui il caricatore di assembly inizia la ricerca degli assembly da caricare in un nuovo dominio applicazione.The following example demonstrates how to use the ApplicationBase property to set the location where the assembly loader begins probing for assemblies to load into a new application domain.

Nota

È necessario verificare che la cartella specificata esista.You must ensure that the folder you specify exists.

using namespace System;

int main()
{
    AppDomain^ root = AppDomain::CurrentDomain;

    AppDomainSetup^ setup = gcnew AppDomainSetup();
    setup->ApplicationBase = 
        root->SetupInformation->ApplicationBase + "MyAppSubfolder\\";

    AppDomain^ domain = AppDomain::CreateDomain("MyDomain", nullptr, setup);

    Console::WriteLine("Application base of {0}:\r\n\t{1}", 
        root->FriendlyName, root->SetupInformation->ApplicationBase);
    Console::WriteLine("Application base of {0}:\r\n\t{1}", 
        domain->FriendlyName, domain->SetupInformation->ApplicationBase);

    AppDomain::Unload(domain);
}

/* This example produces output similar to the following:

Application base of MyApp.exe:
        C:\Program Files\MyApp\
Application base of MyDomain:
        C:\Program Files\MyApp\MyAppSubfolder\
 */
using System;

class ADSetupInformation
{
    static void Main()
    {
        AppDomain root = AppDomain.CurrentDomain;

        AppDomainSetup setup = new AppDomainSetup();
        setup.ApplicationBase = 
            root.SetupInformation.ApplicationBase + @"MyAppSubfolder\";

        AppDomain domain = AppDomain.CreateDomain("MyDomain", null, setup);

        Console.WriteLine("Application base of {0}:\r\n\t{1}", 
            root.FriendlyName, root.SetupInformation.ApplicationBase);
        Console.WriteLine("Application base of {0}:\r\n\t{1}", 
            domain.FriendlyName, domain.SetupInformation.ApplicationBase);

        AppDomain.Unload(domain);
    }
}

/* This example produces output similar to the following:

Application base of MyApp.exe:
        C:\Program Files\MyApp\
Application base of MyDomain:
        C:\Program Files\MyApp\MyAppSubfolder\
 */
Class ADSetupInformation

    Shared Sub Main()

        Dim root As AppDomain = AppDomain.CurrentDomain

        Dim setup As New AppDomainSetup()
        setup.ApplicationBase = _
            root.SetupInformation.ApplicationBase & "MyAppSubfolder\"

        Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", Nothing, setup)

        Console.WriteLine("Application base of {0}:" & vbCrLf & vbTab & "{1}", _
            root.FriendlyName, root.SetupInformation.ApplicationBase)
        Console.WriteLine("Application base of {0}:" & vbCrLf & vbTab & "{1}", _
            domain.FriendlyName, domain.SetupInformation.ApplicationBase)

        AppDomain.Unload(domain)
    End Sub
End Class

' This example produces output similar to the following:
'
'Application base of MyApp.exe:
'        C:\Program Files\MyApp\
'Application base of MyDomain:
'        C:\Program Files\MyApp\MyAppSubfolder\

Commenti

La directory di base dell'applicazione è in cui il gestore di assembly inizia la ricerca degli assembly.The application base directory is where the assembly manager begins probing for assemblies.

Il ApplicationBase proprietà può influenzare le autorizzazioni concesse a un dominio applicazione.The ApplicationBase property can influence which permissions are granted to an application domain. Ad esempio, un dominio dell'applicazione provenienti dal computer locale in genere considerato completamente attendibile basato sulla relativa posizione di origine.For example, an application domain originating from the local computer normally receives full trust based on its location of origin. Tuttavia, se il ApplicationBase proprietà di tale AppDomain è impostato sul nome completo di una directory di rete intranet, il ApplicationBase impostazione limita le autorizzazioni concesse al dominio dell'applicazione a un tipo LocalIntranet anche se il dominio dell'applicazione in realtà ha dal computer locale.However, if the ApplicationBase property of that AppDomain is set to the full name of an intranet directory, the ApplicationBase setting restricts the permissions granted to the application domain to a LocalIntranet grant even though the application domain actually originates from the local computer.

Sicurezza

FileIOPermission
Per accedere alle informazioni sul percorso.for access to the path information. Enumerazione associata: PathDiscoveryAssociated enumeration: PathDiscovery

Si applica a