开发者

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 HttpCo开发者_如何学编程ntext.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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜