Loading remote assembly from the webservice with reflection

0

I am using Assembly.LoadFrom within a web service to load assemblies from a web site. but the problem is it is in the virutal directory and the server.mappath parses the url like \share\mydll.dll and loadform method failed. Is there anyway to reference dll from the remote location?

I've tried passing the url (http://localhost/downloadable/mydll.dll) and again it got "Could not load file or assembly 'http://localhost/downloadable/mydll.dll' or one of its dependencies. HTTP download of assemblies has been disabled for this appdomain. (Exception from HRESULT: 0x80131048)"

.net
web-services
system.reflection
asked on Stack Overflow Apr 18, 2010 by Myat Htut • edited Apr 18, 2010 by Myat Htut

1 Answer

1

You can use the WebClient class to download an assembly over the internet:

using(var wc = new WebClient()) {
    Assembly.Load(wc.DownloadData(url));
answered on Stack Overflow Apr 18, 2010 by SLaks • edited Apr 18, 2010 by SLaks

User contributions licensed under CC BY-SA 3.0