Provides the assembly evidence for an assembly being loaded.
Namespace:
System.Security
Assembly:
mscorlib (in mscorlib.dll)
Visual Basic (Declaration)
Public Overridable Function ProvideAssemblyEvidence ( _
loadedAssembly As Assembly, _
inputEvidence As Evidence _
) As Evidence
Dim instance As HostSecurityManager
Dim loadedAssembly As [Assembly]
Dim inputEvidence As Evidence
Dim returnValue As Evidence
returnValue = instance.ProvideAssemblyEvidence(loadedAssembly, _
inputEvidence)
public virtual Evidence ProvideAssemblyEvidence(
Assembly loadedAssembly,
Evidence inputEvidence
)
public:
virtual Evidence^ ProvideAssemblyEvidence(
Assembly^ loadedAssembly,
Evidence^ inputEvidence
)
public function ProvideAssemblyEvidence(
loadedAssembly : Assembly,
inputEvidence : Evidence
) : Evidence
This method can be overridden in a derived class.
This method is called whenever an assembly is loaded, either implicitly or explicitly. The passed in parameters are the assembly being loaded, and the computed evidence from the common language runtime. The host implementation can choose to extend or reduce the evidence. The return value is the evidence to be used for the assembly. The base implementation always returns the evidence object passed in as the inputEvidence parameter.
Important Note: |
|---|
See the Notes to Inheritors for the HostSecurityManager class for critical implementation information. |
The following code example shows an override of the ProvideAssemblyEvidence method for a custom host security manager. This example is part of a larger example provided for the HostSecurityManager class.
Public Overrides Function ProvideAssemblyEvidence(ByVal loadedAssembly As [Assembly], ByVal evidence As Evidence) As Evidence
Console.WriteLine("Provide assembly evidence for: " + IIf(loadedAssembly Is Nothing, "Unknown", loadedAssembly.ToString()) + ".") 'TODO: For performance reasons this should be changed to nested IF statements
If evidence Is Nothing Then
Return Nothing
End If
evidence.AddAssembly(New CustomEvidenceType())
Return evidence
End Function 'ProvideAssemblyEvidence
public override Evidence ProvideAssemblyEvidence(Assembly loadedAssembly, Evidence evidence)
{
Console.WriteLine("Provide assembly evidence for: " + (loadedAssembly == null ? "Unknown" : loadedAssembly.ToString()) + ".");
if (evidence == null)
return null;
evidence.AddAssembly(new CustomEvidenceType());
return evidence;
}
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0, 2.0
Reference