c# - LoadLibrary call from MVC application running in IIS -


I have a problem executing this line of code in my MVC application:
 
Code> IntPtr HModule = Load Library (Bondprovy settings. AssessmentFilePath);

The problem is that hModule is always 0 .

If I run the same code with the same value for BondProbeSettings.AssemblyFilePath , but instead of MVC app hModule instead of a console application, non-zero

Should I consider any security issue?

The signature for the load Libre is:

  [DllImport ("kernel32.dll", chartset = CharSet.Auto)] Static extern IntPtr LoadLibrary (string lpFileName);    

Change the announcement to:

  [DllImport ("Kernel32.dll", Charset = Charset Auto), SetLastError = true)] Static Extern IntPtr LoadLibrary (string lpFileName);   

And your code:

  IntPtr hModule = LoadLibrary (BondProbeSettings.AssemblyFilePath); Throw new system (hModule == IntPtr.Zero). ComponentModel.Win32Exception ();   

Now you will know why it does not work.

Comments