You can execute partially trusted code within a sandbox that runs with the specified permissions set. Code, including assemblies, executed within the sandbox will be also granted to just the specified permissions set. To create and run a sandbox, you need an instance of the AppDomain class. The example here creates a sandbox for running an external assembly given the LocalIntranet zone’s permissions. Before showing the sandbox example, follow these steps:

1. Create a new Console application and name the new project as ExternalApp.

2. In the Main method simply add a Console.Writeline statement for showing whatever text message you like.

3. Build the project; then create a new folder named C:\MyApps and copy the newly generated ExternalApp.exe ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.