Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Each .NET Framework application runs in an application ___domain under the control of a host that creates the application ___domain and loads assemblies into it. The host has access to information about the code (evidence), such as the zone in which the code originates, or the digital signatures of the assemblies in the application ___domain. A trusted host is a host that has permission to provide the common language runtime with this kind of information. The System.AppDomain class provides the application ___domain functionality used by hosts.
The following table shows the types of application hosts.
Application ___domain host | Description |
---|---|
Browser host (for example, Microsoft Internet Explorer) |
Runs code within the context of a Web site. |
Custom-designed hosts |
Creates domains and loads assemblies into domains, including dynamic assemblies. Can be written in managed or unmanaged code. |
Server host (for example, ASP.NET) |
Runs code that handles requests submitted to a server. |
Shell host |
Launches applications (.exe files) from the shell. |
After creating a new application ___domain, a host can specify the policy to apply to code within the application ___domain. This policy is always subject to the enterprise, machine and user policy. A host can reduce the set of permissions that machine and user policy allow but cannot expand it. Policy can be set only once for an application ___domain. To set application ___domain policy, the host must be granted the security permission (provided through the SecurityPermission class) for controlling ___domain policy.
After application ___domain policy is set, all subsequently loaded assemblies are granted permissions under the new policy (enterprise, machine, user, and application ___domain policy). Previously loaded assemblies get permission grants under the pre-existing policy (enterprise, machine and user policy only). The permissions granted to these assemblies are not reevaluated under the new application ___domain policy.
A trusted host can provide information (evidence) to the runtime about assemblies that are loaded into the application ___domain. If a ___domain host does not have the appropriate SecurityPermission for controlling evidence, the runtime uses the security enforced on the host to determine the security to enforce on the assembly.
In some situations, evidence that would normally be provided by a trusted application ___domain host is actually provided by the loader. Typically, after an application ___domain is created, the application ___domain host loads the first (main) assembly into the application ___domain and calls into that assembly to begin execution. When code in the first assembly references code in another assembly, the loader resolves the reference, loads the appropriate assembly into the application ___domain, and supplies the evidence about the assembly to the runtime. In this situation, the trusted application ___domain host that provided the evidence for the original assembly does not provide evidence to subsequently loaded assemblies.