This documentation is archived and is not being maintained.

AppDomainSetup.ConfigurationFile Property

Gets or sets the name of the configuration file for an application domain.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

public:
virtual property String^ ConfigurationFile {
	String^ get () sealed;
	void set (String^ value) sealed;
}
/** @property */
public final String get_ConfigurationFile ()

/** @property */
public final void set_ConfigurationFile (String value)

public final function get ConfigurationFile () : String

public final function set ConfigurationFile (value : String)

Property Value

A String that specifies the name of the configuration file.

The configuration file describes the search rules and configuration data for the application domain. The host that creates the application domain is responsible for supplying this data because the meaningful values vary from situation to situation.

For example, the configuration data for ASP.NET applications is stored for each application, site, and computer, while the configuration data for an executable is stored for each application, user, and computer. Only the host knows the specifics of the configuration data for a particular circumstance.

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 = gcnew AppDomainSetup;
   domaininfo->ApplicationBase = System::Environment::CurrentDirectory;
   domaininfo->ConfigurationFile = System::Environment::CurrentDirectory + "\\ADCreateDomain.exe.config";
   domaininfo->ApplicationName = "MyApplication";
   domaininfo->LicenseFile = 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( gcnew Url( "http://www.example.com" ) );
   adevidence->AddHost( gcnew Zone( SecurityZone::Internet ) );
   
   // Create the application domain.
   AppDomain^ newDomain = AppDomain::CreateDomain( "MyDomain", adevidence, domaininfo );
   
   // Write out the application domain information.
   Console::WriteLine( "Host domain: {0}", AppDomain::CurrentDomain->FriendlyName );
   Console::WriteLine( "child domain: {0}", newDomain->FriendlyName );
   Console::WriteLine();
   Console::WriteLine( "Application base is: {0}", newDomain->SetupInformation->ApplicationBase );
   Console::WriteLine( "Configuration file is: {0}", newDomain->SetupInformation->ConfigurationFile );
   Console::WriteLine( "Application name is: {0}", newDomain->SetupInformation->ApplicationName );
   Console::WriteLine( "License file is: {0}", newDomain->SetupInformation->LicenseFile );
   IEnumerator^ newevidenceenum = newDomain->Evidence->GetEnumerator();
   while ( newevidenceenum->MoveNext() )
      Console::WriteLine( newevidenceenum->Current );

   AppDomain::Unload( newDomain );
}


import System.*;
import System.Reflection.*;
import System.Security.Policy.*; //for evidence object
import System.Security.*;        //for securityzone object
import System.Collections.*;     //for IEnumerator
 
class ADCreateDomain
{
    public static void main(String[] args)
    {
        // Create appdomainsetup information for the new appdomain.
        AppDomainSetup domainInfo = new AppDomainSetup();

        domainInfo.set_ApplicationBase(System.Environment.get_CurrentDirectory());
        domainInfo.set_ConfigurationFile(System.Environment.get_CurrentDirectory() 
            + "ADCreateDomain.exe.config");
        domainInfo.set_ApplicationName("MyApplication");
        domainInfo.set_LicenseFile(
            System.Environment.get_CurrentDirectory() + "license.txt");

        //Create evidence for new appdomain.
        Evidence adEvidence = AppDomain.get_CurrentDomain().get_Evidence();

        //Add the zone and url information to restrict permissions 
        //assigned to the appdomain.
        adEvidence.AddHost(new Url("http://www.example.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.get_CurrentDomain().get_FriendlyName());
        Console.WriteLine("child domain: " + newDomain.get_FriendlyName());
        Console.WriteLine();
        Console.WriteLine("Application base is: " 
            + newDomain.get_SetupInformation().get_ApplicationBase());
        Console.WriteLine("Configuration file is: " 
            + newDomain.get_SetupInformation().get_ConfigurationFile());
        Console.WriteLine("Application name is: " 
            + newDomain.get_SetupInformation().get_ApplicationName());
        Console.WriteLine("License file is: " 
            + newDomain.get_SetupInformation().get_LicenseFile());

        IEnumerator newEvidenceEnum = newDomain.get_Evidence().GetEnumerator();
        while (newEvidenceEnum.MoveNext()) {
            Console.WriteLine(newEvidenceEnum.get_Current());
        }

        AppDomain.Unload(newDomain);
    } //main 
} //ADCreateDomain 

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Show: