Introduce DataBase,Asp.net,JavaScript,Xml,Html,Css,Sql,Php,ASP.NET Controls,AJAX,Tools,HTML,CSS,JavaScript,Open Source Project,WPF,.Net Framework,Linq
Top Recommended Hosting

Loading plugins from a partial-trust Application Domain

by the3factory 3/23/2008 7:19:00 AM
Question:
Hello. I am having some difficulty understanding the documentation and figuring out how to do the subject. My intent is to limit the extent to which third-party plugins for my application could potentially affect the user's computer.

The logical answer is to load plugins (in the form of DLLs) into an AppDomain specifically set up with limited trust, such that even if the plugin did attempt to perform some malicious activity, the OS would not allow it.

However, simple as this idea is, I am having trouble after trouble. Most recently I stumbled upon this gem in the documentation for AppDomain.Load():

"If the current AppDomain object represents application domain A
Answer1:
With .NET 3.5 comes the System.Addin library which tackles these kind of problems... 



Tim Van Wassenhove - Please remember to mark the replies as answers if they help.
Answer2:
Good to know, however I'm using .NET 2.0 at the moment.
Answer3:
I think maybe you can write a proxy assembly loaded in both domains and let it load the assembly in the seperate domain.

And even you cannot use the Addin model, you can check out the CLR AddIn Model in Paint.Net series on
Jason He's WebLog to adopt it's ideas.
Answer4:
Thanks I might check that out. In the meantime I seem to have gotten this to work, so long as the subclass of ICustomizerPlugin inherits from MarshalByRefObject:

Code Snippet

Related posts

Sign up for PayPal and start accepting credit card payments instantly.


Powered by BlogEngine.NET 1.2.0.0