LoadFrom Method (String, Evidence)
Collapse the table of content
Expand the table of content

Assembly.LoadFrom Method (String, Evidence)

.NET Framework 1.1

Loads an assembly given its file name or path and supplying security evidence.

[Visual Basic]
Overloads Public Shared Function LoadFrom( _
   ByVal assemblyFile As String, _
   ByVal securityEvidence As Evidence _
) As Assembly
public static Assembly LoadFrom(
 string assemblyFile,
 Evidence securityEvidence
public: static Assembly* LoadFrom(
 String* assemblyFile,
 Evidence* securityEvidence
public static function LoadFrom(
   assemblyFile : String,
 securityEvidence : Evidence
) : Assembly;


The name or path of the file that contains the manifest of the assembly.
Evidence for loading the assembly.

Return Value

The loaded assembly.


Exception Type Condition
ArgumentNullException assemblyFile is a null reference (Nothing in Visual Basic).
FileNotFoundException assemblyFile is not found, or the module you are trying to load does not specify a filename extension.
BadImageFormatException assemblyFile is not a valid assembly.
SecurityException A codebase that does not start with "file://" was specified without the required WebPermission.
PathTooLongException An assembly or module was loaded twice with two different evidences, or the assembly name is longer than MAX_PATH characters.
ArgumentException The assemblyFile parameter is the empty string ("").


The assemblyFile parameter must refer to a URI without escape characters. This method supplies escape characters for all invalid characters in the URI.

assemblyFile is relative to the current directory, and the assembly is loaded into the domain of the caller.

The LoadFrom methods use a load context that records the assembly name and the assembly instance information for the set of assemblies that is the transitive closure of the assemblies loaded by the application using LoadFrom. The LoadFrom load context applies to assemblies that are loaded using their locations.

Whether certain permissions are granted or not granted to an assembly is based on evidence. The rules for assembly and security evidence merging are as follows:

  • When you use a LoadFrom method with no Evidence parameter, the assembly is loaded with the evidence that the loader supplies.
  • When you use a LoadFrom method with an Evidence parameter, pieces of evidence are merged. Pieces of evidence supplied as an argument to the LoadFrom method supersede pieces of evidence supplied by the loader.
  • When you use a LoadFrom method with a Byte[] parameter to load a common object file format (COFF) image, evidence is combined. Zone, Url and Site are inherited from the calling assembly, and Hash and StrongName are taken from the COFF assembly.
  • When you use a LoadFrom method with a Byte[] parameter and Evidence to load a common object file format (COFF) image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image is ignored.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

Assembly Class | Assembly Members | System.Reflection Namespace | Assembly.LoadFrom Overload List | Evidence

© 2016 Microsoft