executable and source - nexec.zip
nexec is an application to run .NET smart clients from http servers.
To run a smart client from a url:
nexec url [arg1 arg2 .....]
To run a smart client from a url with the permission set of a zone:
nexec -z zone url [arg1 arg2 .....]
where zone is one of Internet, Intranet, MyComputer. For
nexec -z MyComputer http://www.cookcomputing.com/MathApp.exe
The case of running a smart client without overriding the configured permission set it should run with is trivial. Assembly.LoadFrom is called, the entry point into the application obtained and then invoked.
The case where a zone is specified is more complicated. LoadFrom is used to load the main assembly of the smart client, passing in an instance of class Evidence containing a Zone which specifies the security zone the caller would like the client to run in. In this case it is also necessary to explicitly load any referenced assemblies which need to be downloaded. If they are implicitly loaded then the evidence used to determine their security setting is that configured on the machine, not the evidence used in the LoadFrom call for the main assembly.
The method of loading the sub-assemblies at the moment is probably hopelessly naive but works in the simple cases I have tested. All referenced assemblies are recursively loaded using first a call to Load and then if that fails a call to LoadFrom using the same base url as the smart client's url.
Disclaimer: running smart client apps with this tool allows potentially damaging code to run on your machine.