Determine the Evidence Associated with an Assembly

Problem

You want to determine the evidence that the .NET security infrastructure uses to determine the permissions of a piece of code.

Solution

Create a System.Reflection.Assembly object, and walk through all the items in the Evidence collection.

Discussion

It’s often useful to be able to read the evidence that .NET attaches to an assembly. This is particularly important when debugging code access security settings with a distributed application that uses reflection to load assemblies from the Internet. (See recipe Load an Assembly from a Remote Location for a specific example.)

You can retrieve the evidence for any assembly through the Assembly.Evidence property. This property returns a System.Security.Policy.Evidence ...

Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.