partialTrustVisibleAssemblies Element (ASP.NET Settings Schema)

Configures a set of partial-trust visible assemblies for an application.

<configuration> Element
  system.web Element (ASP.NET Settings Schema)
    partialTrustVisibleAssemblies Element (ASP.NET Settings Schema)

<partialTrustVisibleAssemblies>
   <add... />
   <remove... />
   <clear/>
</partialTrustVisibleAssemblies>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

None.

Child Elements

Element

Description

add

Optional element.

Adds a reference to a partial-trust visible assembly.

clear

Optional element.

Removes all references to partial-trust visible assemblies.

remove

Optional element.

Removes a reference to a partial-trust visible assembly.

The value must exactly match that of a previous add directive.

Parent Elements

Element

Description

configuration

Specifies the required root element in every configuration file that is used by the common language runtime and .NET Framework applications.

system.web

Specifies the root element for the ASP.NET configuration section.

Remarks

The partialTrustVisibleAssemblies section and the related PartialTrustVisibleAssembly type are used for partial-trust scenarios. By default, the following ASP.NET partial-trust assemblies are marked with the conditional Allow Partially Trusted Callers Attribute (APTCA):

  • System.Web.dll

  • System.Web.Extensions.dll

  • System.Web.Abstractions.dll

  • System.Web.DynamicData.dll

  • System.Web.Routing.dll

You can add assemblies to this list by configuring the partialTrustVisibleAssemblies section of the Web.config file.

If you mark an assembly with the conditional APTCA attribute to allow partially trusted callers, and if you want to make the assembly both visible and accessible to partial-trust code in your Web application, you must add a reference to the assembly in the partialTrustVisibleAssemblies section by using the add element. For more information about the APTCA attribute, see the AllowPartiallyTrustedCallersAttribute class.

Example

The following example shows how to add an assembly marked with the APTCA attribute to the partialTrustVisibleAssemblies section. For the publicKey attribute, you must supply the hexadecimal string representation of a public key value. To get the hexadecimal string representation of a public key, use the Strong Name tool (Sn.exe).

<configuration>
  <system.web>
    <partialTrustVisibleAssemblies>
      <add assemblyName = "My.Assembly" 
           version = "2.0.0"
           publicKey = "hex_key_representation"/>
    </partialTrustVisibleAssemblies>
  </system.web>
</configuration>

See Also

Reference

PartialTrustVisibleAssembliesSection

PartialTrustVisibleAssembly

PartialTrustVisibleAssemblyCollection

fullTrustAssemblies Element (ASP.NET Settings Schema)

AllowPartiallyTrustedCallersAttribute