Assembly loaded from URL needs to read registry - but can't

From: gkelly (gkelly_at_xmission.com)
Date: 02/25/05


Date: Thu, 24 Feb 2005 17:49:52 -0700

I have a set of applications that use a common assembly library.

AppA, AppB and AppC all use LibA and LibB

These will run on about 25 computers.

AppA and LibA need to read registry to determine database connect string to
use and other misc config stuff

For a while anyway, all code will be updated periodically. So, I decided
place code on our web server.

Instead of AppA and AppB being "Windows Applications" I changed them to
Class Libraries.

I created a Launcher App that will use Assembly.LoadFrom to load from a url
like http://server/applib/AppA.dll

However, since code loaded this way runs in a different context I get an
error error such as:

Request for the permission of type
System.Security.Permissions.RegistryPermission failed..

I have read about this and somewhat understand the issues involved.

Question: Is there a "simple" way to load a dll from a URL and have it run
with the same permission as code that was
loaded locally?

I thought the following would work, but it doesnt. Same error happens. So,
obviously my understanding is very limited.

Evidence ev = new Evidence();
ev.Merge( AppDomain.CurrentDomain.Evidence );
ev.AddHost( new Zone( SecurityZone.MyComputer ));
Assembly v_assembly = Assembly.LoadFrom( "http://server/applib/AppA.dll",
ev );

when creating an object instance from this assembly it still can't read the
registry. I "thought" this would load the assembly so that's
it's code would run with same permissions as the launcher. It doesn't.

Any help would be appreciated.

gkelly



Relevant Pages

  • Re: is threading useful with a single CPU?
    ... Take two applications, AppA and AppB. ... Going back to AppA and AppB, when you launch these two applications, AppA ... Multiple threads within a single process are used to execute code ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Process & memory usage guru question
    ... As far as thread pools go, AppA has an item to process, it calls the ... CreateProcess to execute cmd.exe to start AppB. ... AppB launches pkzip. ...
    (microsoft.public.vc.mfc)
  • Re: Process & memory usage guru question
    ... AppB launches pkzip. ... I am still uncertain as to why AppA is exiting unexpectedly. ... CreateProcess() when you simply want to run pkzip to compress files. ...
    (microsoft.public.vc.mfc)
  • Re: Process & memory usage guru question
    ... I have been trying to use OH.exe that is available in the "Windows Resource ... There is ZERO chance that any memory problems in appB will have any effect on appA. ... To start the AppB app that does the zipping, we call one of our DLL ...
    (microsoft.public.vc.mfc)
  • Re: Pipe stderr and stdout
    ... I'd like to pipe stdout and stderr from appA to appB and appC (appB ...
    (comp.unix.shell)