Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load Assembly with custom Permissions

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.

like image 251
Jeff Avatar asked Nov 15 '22 06:11

Jeff


1 Answers

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...

like image 139
Jeff Avatar answered Dec 27 '22 02:12

Jeff