In a shell application, I should be able to load and execute other .NET assemblies at runtime, but they are not complete Trust to give Basically, I want to limit them (loaded assemblies) to touch any system resources (threading, networking, etc.), with only the exception, with different storage. However, the assemblies meeting with "m" need to be executed with full confidence.
I'm considering code access protection, but I'm pretty sure I should use it.
How can you go about this?
CAS is too much that you need here more specifically, in your own application domain Want to load the assembly:
var myEvidence = new evidence (new object [] {SecurityZone.Internet}); Var newDomain = AppDomain.CreateDomain ("InternetDomain"); MyDomain.Load ("MyUntrustedAssembly.dll", My Experience); MyDomain.CreateInstanceAndUnwrap ("MyUntrustedAssembly", "MyUntrustedObjectType"); // Do your work with unbelievable assembly / AppDomain.Unload (myDomain);
Set the application domain, various fields, and the default permission set on them. The Internet is the most restrictive of system-defined areas / permission sets, in which the legislative assemblies can still be executed (there are also restricted areas, the legislative assembly falling in this area can not run). You can use the .NET Configuration Tool to create permission sets and can define terms (evidence) that the code should be satisfied to provide permission set.
Comments
Post a Comment