Export (0) Print
Expand All

ActivationContext Class

Note: This class is new in the .NET Framework version 2.0.

Identifies the activation context for the current application. This class cannot be inherited.

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

[SerializableAttribute] 
[ComVisibleAttribute(false)] 
public sealed class ActivationContext : IDisposable, ISerializable
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(false) */ 
public final class ActivationContext implements IDisposable, ISerializable
SerializableAttribute 
ComVisibleAttribute(false) 
public final class ActivationContext implements IDisposable, ISerializable

The ActivationContext class contains an ApplicationIdentity and provides internal-only access to the application manifest. The activation context is used during manifest-based activation to set up the domain policy and provide an application-based security model. For more information, see the ApplicationSecurityManager class.

The following code example demonstrates the use of an ActivationContext object to obtain the ApplicationIdentity for a manifest-based application. For correct results, execute this code example as 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;

namespace ActivationContextSample
{
    public class Program : MarshalByRefObject
    {
        [SecurityPermission(SecurityAction.LinkDemand, ControlDomainPolicy=true)]
        public static void Main(string[] args)
        {
            ActivationContext ac = AppDomain.CurrentDomain.ActivationContext;
            ApplicationIdentity ai = ac.Identity;
            Console.WriteLine("Full name = " + ai.FullName);
            Console.WriteLine("Code base = " + ai.CodeBase);

            Console.Read();
        }
        [SecurityPermission(SecurityAction.LinkDemand, ControlDomainPolicy=true)]
        public void Run()
        {
            Main(new string[] { });
            Console.ReadLine();
        }
    }
}

System.Object
  System.ActivationContext

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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

Community Additions

ADD
Show:
© 2014 Microsoft