Export (0) Print
Expand All

AppDomainSetup.LicenseFile Property

Gets or sets the location of the license file associated with this domain.

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

public string LicenseFile { get; set; }
/** @property */
public final String get_LicenseFile ()

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

public final function get LicenseFile () : String

public final function set LicenseFile (value : String)

Not applicable.

Property Value

A String that specifies the name of the license file.

The following example demonstrates how to use the LicenseFile property to specify the location and name of the license file for a new application domain.


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 = 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(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.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);
	
		
	}
	
}


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 Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft