3 Replies - 1584 Views - Last Post: 05 January 2012 - 10:03 AM Rate Topic: -----

#1 slammers  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 22-November 11

Loading A DLL from a network Share

Posted 05 January 2012 - 08:09 AM

I have a program that uses Reflection to load DLLs at runtime. Everything works fine until I try and run the program from a network share. The function System.Reflection.Assembly.LoadFile() fails with the following error

An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft..../?LinkId=155569 for more information.

The provided link did not help me much. Does anyone know how to get around this problem?

Thanks
Shawn

Is This A Good Question/Topic? 0
  • +

Replies To: Loading A DLL from a network Share

#2 Curtis Rutland  Icon User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4577
  • View blog
  • Posts: 8,019
  • Joined: 08-June 10

Re: Loading A DLL from a network Share

Posted 05 January 2012 - 08:12 AM

The link tells you to modify your web.config/app.config, and gives an example of what XML you're supposed to include. Have you tried that?
Was This Post Helpful? 0
  • +
  • -

#3 slammers  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 22-November 11

Re: Loading A DLL from a network Share

Posted 05 January 2012 - 09:32 AM

Yes, I just found that and it did work. However, now I have to have the file

appname.exe.config

in the same directory as the executable. Not really a problem I guess, but is there a way to do this in the actual code so this file is not required?
Was This Post Helpful? 0
  • +
  • -

#4 Curtis Rutland  Icon User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4577
  • View blog
  • Posts: 8,019
  • Joined: 08-June 10

Re: Loading A DLL from a network Share

Posted 05 January 2012 - 10:03 AM

Not as far as I'm aware. .NET assemblies often rely on config files.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1