2

I'm creating a web-related application and I want to add plugin support to it. But I want the plugin dlls to be restricted from everything except my SaveSettings(), RequestPage() and SendToHost() methods. Any good examples how to do that?

blez
  • 4,939
  • 5
  • 50
  • 82

1 Answers1

0

You can require your plugins to implement an interface which contains those three methods. In your code then you would call those methods where it is necessary to apply the plugin functionality.

Of course this will not prevent them from executing code within those methods that is not desirable. This becomes more of a security problem in this case. I can't think of a straightforward way of doing this except to load the plugin assemblies into another AppDomain and set security restrictions on the AppDomain about what they can do. This will also of course complicate how you pass data between your plugin and your code.

Can Gencer
  • 8,822
  • 5
  • 33
  • 52