Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

ActivationContext Class

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
Not applicable.

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 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
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.