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

ApplicationSecurityInfo Class

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

Holds the security evidence for an application. This class cannot be inherited.

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

[ComVisibleAttribute(true)] 
public sealed class ApplicationSecurityInfo
/** @attribute ComVisibleAttribute(true) */ 
public final class ApplicationSecurityInfo
ComVisibleAttribute(true) 
public final class ApplicationSecurityInfo

ApplicationSecurityInfo provides security information about a manifest-activated application using information obtained from the application's manifests and its ActivationContext.

ApplicationSecurityInfo is used as a key in the dictionary for the ApplicationSecurityManager.UserApplicationTrusts property.

The following code example displays the ApplicationId properties by obtaining the ApplicationId from the ApplicationSecurityInfo instances contained in the UserApplicationTrusts property of the ApplicationSecurityManager.

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.Demand, ControlDomainPolicy = true)]
        public static void Main(string[] args)
        {
            Console.WriteLine("Full name = " +
                AppDomain.CurrentDomain.ActivationContext.Identity.FullName);
            Console.WriteLine("Code base = " +
                AppDomain.CurrentDomain.ActivationContext.Identity.CodeBase);
            ApplicationSecurityInfo asi = new ApplicationSecurityInfo(AppDomain.CurrentDomain.ActivationContext);

            Console.WriteLine("ApplicationId.Name property = " + asi.ApplicationId.Name);
            if (asi.ApplicationId.Culture != null)
                Console.WriteLine("ApplicationId.Culture property = " + asi.ApplicationId.Culture.ToString());
            Console.WriteLine("ApplicationId.ProcessorArchitecture property = " + asi.ApplicationId.ProcessorArchitecture);
            Console.WriteLine("ApplicationId.Version property = " + asi.ApplicationId.Version);
            // To display the value of the public key, enumerate the Byte array for the property.
            Console.Write("ApplicationId.PublicKeyToken property = ");
            byte[] pk = asi.ApplicationId.PublicKeyToken;
            for (int i = 0; i < pk.GetLength(0); i++)
                Console.Write("{0:x}", pk[i]);

            Console.Read();
        }

        public void Run()
        {
            Main(new string[] { });
            Console.ReadLine();
        }
    }
}

System.Object
  System.Security.Policy.ApplicationSecurityInfo
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
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.