Loading an Assembly from a URL

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello-

I'm looking to do something similar to Assebly.Load or
Assembly.LoadFrom, but rather than specify the file name, I want to give it a
URL, so, I could do something like this:

Assembly a = Assembly.LoadFrom("http://mysite/myAssembly.dll");

Does anyone know how to do this, or something equivalent?

Regards-
Eric
 
Hi,

using System.Net;

Webclient class,
DownloadFile method can download file and load it to Assembly.
 
Mattias-

That's great news. So does the assembly that loads the other assembly
require the WebPermission? Then does the loaded assembly run with the same
permissions as the loading assembly (assuming no Evidence object is passed to
the Load method)? Lastly, what is the best way to grant the required
WebPermission to an assembly? Thanks for your help.

Regards-
Eric
 
The downlading assembly will need the WebPermission.

The downloaded assembly will run with permissions relevant to the evidence it presents to CAS policy. In other words, unless you have changed CAS policy it will run with the Intranet permission set.

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Mattias-

That's great news. So does the assembly that loads the other assembly
require the WebPermission? Then does the loaded assembly run with the same
permissions as the loading assembly (assuming no Evidence object is passed to
the Load method)? Lastly, what is the best way to grant the required
WebPermission to an assembly? Thanks for your help.

Regards-
Eric
 
Back
Top