ITWorker ITWorker - 1 year ago 99
ASP.NET (C#) Question

How to access DLL in bin folder of ASP.NET MVC project?

I am trying to use the following to access a DLL in the project's bin folder:

public ActionResult EncryptFile()
Assembly SampleAssembly;

var dllFile = new FileInfo(@".\\bin\\encrypt.dll");
SampleAssembly = Assembly.LoadFile(dllFile.FullName);

I also attempted
var dllFile = new FileInfo(@"\\bin\\encrypt.dll");
(note lack of
before the filepath), but it did not work either. In the debugger, the
in this second case.

What can I do to make it locate the file?

Thank you.

Answer Source


Assembly SampleAssembly = Assembly.LoadFile(Server.MapPath(@"~/bin/encrypt.dll"));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download