ActivationArguments Class

Provides data for manifest-based activation of an application. This class cannot be inherited.

System.Object
  System.Security.Policy.EvidenceBase
    System.Runtime.Hosting.ActivationArguments

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

[SerializableAttribute]
[ComVisibleAttribute(true)]
public sealed class ActivationArguments : EvidenceBase

The ActivationArguments type exposes the following members.

  NameDescription
Public methodActivationArguments(ActivationContext)Initializes a new instance of the ActivationArguments class with the specified activation context.
Public methodActivationArguments(ApplicationIdentity)Initializes a new instance of the ActivationArguments class with the specified application identity.
Public methodActivationArguments(ActivationContext, String[])Initializes a new instance of the ActivationArguments class with the specified activation context and activation data.
Public methodActivationArguments(ApplicationIdentity, String[])Initializes a new instance of the ActivationArguments class with the specified application identity and activation data.
Top

  NameDescription
Public propertyActivationContextGets the activation context for manifest-based activation of an application.
Public propertyActivationDataGets activation data from the host.
Public propertyApplicationIdentityGets the application identity for a manifest-activated application.
Top

  NameDescription
Public methodCloneProduces a copy of the current ActivationArguments object. (Overrides EvidenceBase.Clone().)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The ActivationArguments class is used by the AppDomainSetup class.

The manifest-based activation model uses an application manifest rather than an assembly for activation. A manifest fully describes the application, its dependencies, security requirements, and so forth. The manifest model has several advantages over the assembly-based activation model, especially for Web applications. For example, the manifest contains the security requirements of the application, which enables the user to decide whether to allow the application to execute before downloading the code. The manifest also contains information about the application dependencies.

The following code example shows how to obtain the current ActivationArguments object from the AppDomainSetup for the AppDomain of a manifest-based application.

using System;
using System.Collections;
using System.Text;
using System.Security.Policy;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Runtime.Hosting;

namespace ActivationContextSample
{
    public class Program : MarshalByRefObject
    {
        [SecurityPermission(SecurityAction.LinkDemand, ControlDomainPolicy=true)]
        public static void Main(string[] args)
        {
            // Get the AppDomainManager from the current domain.
            AppDomainManager domainMgr = AppDomain.CurrentDomain.DomainManager;
            // Get the ApplicationActivator from the AppDomainManager.
            ApplicationActivator appActivator = domainMgr.ApplicationActivator;
            Console.WriteLine("Assembly qualified name from the application activator.");
            Console.WriteLine(appActivator.GetType().AssemblyQualifiedName);
            // Get the ActivationArguments from the SetupInformation property of the domain.
            ActivationArguments activationArgs = AppDomain.CurrentDomain.SetupInformation.ActivationArguments;
            // Get the ActivationContext from the ActivationArguments.
            ActivationContext actContext = activationArgs.ActivationContext;
            Console.WriteLine("The ActivationContext.Form property value is: " +
                activationArgs.ActivationContext.Form);
            Console.Read();
        }
	[SecurityPermission(SecurityAction.LinkDemand, ControlDomainPolicy=true)]
        public void Run()
        {
            Main(new string[] { });
            Console.ReadLine();
        }
    }
}

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft