Calling a dll from .NET

dsgreen57

Well-known member
Joined
Mar 31, 2003
Messages
66
I am having major problems calling a dll (which is not a true COM dll & has no associated type library)

I have put the dll in the bin directory of the application, give the appropriate user rights for asp.net user to be able to access it.

Code:
using System.Runtime.InteropServices;
...
...
[ DllImport( "SLGXAPI.Dll")]
  public static extern int slapi_Login(string userName, string password);

int loggedIn = SalesLogixDatabaseFunctions.slapi_LogInto("Database", "User", "Password");

The same code works from an Windows Application but when run from ASP.NET Application fails. It doesnt give any error message it just will still be running doing nothing 30 minutes later even an hour later.

You are not able to register this dll as it is not a true com dll.
 
Solved the problem the dll tried to logon to a database connection using a bde connection, which the aspnet user didnt have permission to do.

Using impersonation features I have managed to get around the problem.
 
I added the following line to the web.config file...

Code:
<identity impersonate="true" />

I then went into IIS for the web site set-up for my web application and changed the anoymous access security setting to use a user with enough security permissions to access BDE connections set-up on my machine.

The code included within the thread now works, and correctly logs onto a database and transfers information.

Related URL for web security settings:


http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconaspnetimpersonation.asp
http://www.microsoft.com/technet/tr...2003/proddocs/standard/sec_acc_anonaccess.asp
 

Similar threads

R
Replies
0
Views
164
RGwolf
R
J
Replies
0
Views
116
josh_bauer2020
J
Back
Top