ApplicationDirectory
Summary
Represents the application directory for code that is granted a specific set of permissions. This class cannot be inherited.
Description
The ApplicationDirectory class is used to specify the directory containing an application. When code originates from the application directory, it is granted the permissions defined by a code group. This is a fundamental concept in .NET security policy, allowing administrators to grant specific privileges to applications installed in designated locations.
Syntax
public sealed class ApplicationDirectory : System.Security.Policy.IMembershipCondition
Remarks
The ApplicationDirectory class implements the IMembershipCondition interface. When a membership condition is evaluated, the .NET security system checks if the code's origin (specifically, its evidence) matches the criteria defined by the condition. For ApplicationDirectory, this means checking if the code is located within the directory specified by the policy.
This class is often used in conjunction with a CodeGroup to define security policies. For example, you might create a CodeGroup that has an ApplicationDirectory membership condition and then assign a specific set of permissions to that code group.
Inheritance Hierarchy
System.Object
↳ System.Security.Policy.ApplicationDirectory
Members
Constructors
| Name | Description |
|---|---|
| ApplicationDirectory() | Initializes a new instance of the ApplicationDirectory class. |
Methods
| Name | Description |
|---|---|
| Check(System.Security.Policy.Evidence) | Determines whether the specified evidence indicates that the code is subject to the membership condition. |
| Copy() | Creates and returns a copy of the current membership condition. |
| Equals(System.Object) | Determines whether the specified Object is equal to the current Object. |
| GetHashCode() | Serves as a hash function for the current type. |
| Parse(System.String) | Parses a security element, and returns a policy element that is the Security Object. |
| ToString() | Returns a string representation of the current object. |
Methods (Implementing IMembershipCondition)
The ApplicationDirectory class implements the IMembershipCondition interface, which includes the following methods:
| Name | Description |
|---|---|
| Copy() | Creates and returns a copy of the current membership condition. |
| Check(System.Security.Policy.Evidence) | Determines whether the specified evidence indicates that the code is subject to the membership condition. |
| Equals(System.Object) | Determines whether the specified Object is equal to the current Object. |
| GetHashCode() | Serves as a hash function for the current type. |
ApplicationDirectory()
Initializes a new instance of the ApplicationDirectory class.
public ApplicationDirectory();
Remarks: This constructor creates an ApplicationDirectory object that represents the directory from which the application is run.
Check(System.Security.Policy.Evidence)
Determines whether the specified evidence indicates that the code is subject to the membership condition.
public bool Check(System.Security.Policy.Evidence evidence);
Parameters:evidence: The evidence for the assembly or application.
Returns: true if the specified evidence indicates that the code is subject to the membership condition; otherwise, false.
Copy()
Creates and returns a copy of the current membership condition.
public System.Security.Policy.IMembershipCondition Copy();
Returns: A copy of the current membership condition.
Equals(System.Object)
Determines whether the specified Object is equal to the current Object.
public override bool Equals(System.Object obj);
Parameters:obj: The Object to compare with the current Object.
Returns: true if the specified Object is equal to the current Object; otherwise, false.
GetHashCode()
Serves as a hash function for the current type.
public override int GetHashCode();
Returns: A hash code for the current object.
Parse(System.String)
Parses a security element, and returns a policy element that is the Security Object.
public System.Security.Policy.IMembershipCondition Parse(System.String str);
Parameters:str: The string representation of a security element.
Returns: The Security Object that is equivalent to the supplied security element.
ToString()
Returns a string representation of the current object.
public override string ToString();
Returns: A string that represents the current object.
Copy() (Implementing IMembershipCondition)
Creates and returns a copy of the current membership condition.
System.Security.Policy.IMembershipCondition System.Security.Policy.IMembershipCondition.Copy();
Check(System.Security.Policy.Evidence) (Implementing IMembershipCondition)
Determines whether the specified evidence indicates that the code is subject to the membership condition.
bool System.Security.Policy.IMembershipCondition.Check(System.Security.Policy.Evidence evidence);
Equals(System.Object) (Implementing IMembershipCondition)
Determines whether the specified Object is equal to the current Object.
bool System.Security.Policy.IMembershipCondition.Equals(System.Object obj);
GetHashCode() (Implementing IMembershipCondition)
Serves as a hash function for the current type.
int System.Security.Policy.IMembershipCondition.GetHashCode();