Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3952288
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:49:58+00:00 2026-05-20T01:49:58+00:00

I used DLLImport[absolute path of the C++ dll] in my asp.net C# code to

  • 0

I used DLLImport[absolute path of the C++ dll] in my asp.net C# code to call a method that is inside a C++ dll. And that works perfectly.

I then published the website on IIS and it says it cannot load the dll.

Can you please suggest how to resolve this issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T01:49:59+00:00Added an answer on May 20, 2026 at 1:49 am

    I use a Native LoadLibrary to load the DLL from a specific location. The below URL talks about how this can be done.

    I am assuming you have the right permission set’s available to work with unmanaged code, you use something on the lines of:

    private static bool CanCallUnmanagedCode
    {
     get
      {
      try
      {
        new SecurityPermission(SecurityPermissionFlag.Unmanage dCode).Demand();
      }
      catch(SecurityException)
      {
        return false;
      }
      return true;
     }
    }
    
    void Page_Load(Object sender, EventArgs e)
    {
      if (CanCallUnmanagedCode)
        Label1.Text = "This page can call unmanaged code.";
    else
        Label1.Text = "This page can NOT call unmanaged code.";
    }
    

    Where Label1 is :

    <asp:Label id="Label1" Text="Label Control" runat="server"/>
    

    Next thing is to check the bitness of you asp.net environment to ensure it matches you .dll… as x86 DLL cannot be loaded via a x64 environment.

    How to call C++ DLL from ASP.NET (C#) code?

    http://msdn.microsoft.com/en-us/library/ms684175

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've import dll in my code like that: [DllImport(dll.dll, CharSet = CharSet.Ansi)] private static
i used this code: List<string> lists=new List<string>(apple,orange,banana,apple,mang0,orange); string names; names=lists.Distinct() is that correct?
Possible Duplicate: SendInput and 64bits I'm using SendInput from .NET code (PInvoke). code used
the following code is supposed to replace the system color that's used for window
If using code like the following to impersonate another user, [DllImport(advapi32.dll, SetLastError = true)]
I work on a project that requires .Net interoperability with unmanaged code. I started
I'm trying to write some C# code that calls a method from an unmanaged
I am developing C++ component dll that can be used by C or C++
All the examples I can find using DLLImport to call C++ code from C#
Used code I found on SO to use the COM based Acrobat Reader to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.