Question

I need to load an untrusted assembly into my AppDomain. I don't want to Sandbox a new AppDomain for this assembly to execute in, because it internally requires access to certain functionality such as HttpContext.Current (which would be null in a separate sandboxed AppDomain).

I think the old way of doing this would have been calling Assembly.Load with some custom Evidence, but it looks like this has been made obsolete by the CAS changes in 4.0:

http://msdn.microsoft.com/en-us/library/ms145229.aspx

http://msdn.microsoft.com/en-us/library/ee191568(VS.100).aspx

I don't quite understand how I can accomplish what I want here with the new security model... Could someone please explain or suggest an alternative approach?

Thanks.

Was it helpful?

Solution

The article is an immense mouthful...

http://msdn.microsoft.com/en-us/library/dd984947.aspx

But I finally found what I was looking for:

http://msdn.microsoft.com/en-us/library/system.web.hosting.hostsecuritypolicyresolver.aspx

Just took a long long time to find...

OTHER TIPS

You can revert to the legacy model by modifying your applications configuration, the second link contains a reference right at the top but see here for more info. Then you can just used mixed trust assemblies in the default appdomain.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top