C++ DLL Freezes when called from VB.NET Webform? - NEED HELP!!!!!

J

James Radke

Hello,

I have a C++ DLL that is supplied by an ERP vendor (MAX Software), that provides API's to be used to update their BTRIEVE database from an external application.

I have the C++ DLL working fine from a VB.NET windows application. However, when I cut and paste the same code into a WEBFORM application, the entire application freezes when I try to reference my first function from the DLL; and I don't get any error generated which is telling me what the problem is.

The code for my class has been included below. The lines in RED show the function that is causing the application to freeze, as well as the place in the ADD method from where it is being called.

Can anyone help me out and tell me why this web application is freezing? What security will I need on the BTRIEVE data directory to allow the web application to access it?

Thanks!

Jim

================================ class object ============================================================================

Imports System.Data
Imports System.Data.Odbc
Imports System.Data.SqlClient
Imports System.Math
Imports System.Runtime.InteropServices
Imports System.Text

Public Class SalesOrderMasterClass
' Max startup and shutdown functions
Declare Function InitMAXOrder Lib "MAXORDR2.DLL" (ByRef DataPath As StringBuilder, ByRef MAXPath As StringBuilder) As Int32
Declare Function ShutdownMAXOrder Lib "MAXORDR2.DLL" (ByVal ObjectHandle As Integer) As Short

' Sales Order Functions
Declare Function AddSalesOrder Lib "MAXORDR2.DLL" (ByVal OH As Integer, ByRef Soemst As SOEMstItem) As Short


Public Function Add(ByVal ADDR1 As String, ByVal ADDR2 As String, ByVal City As String, ByVal Contact As String, ByVal Country As String, ByVal CUSTID As String, ByVal CustomerName As String, ByVal CUSTPO As String, ByVal FOB As String, ByVal GLXREF As String, ByVal OrderDate As Date, ByVal OrderedBy As String, ByVal PHONE As String, ByVal REP1 As String, ByVal SHPCDE As String, ByVal SHPVIA As String, ByVal State As String, ByVal SType As String, ByVal TAXCD1 As String, ByVal TAXCD2 As String, ByVal TAXCD3 As String, ByVal Terms As String, ByVal ZIPCD As String) As String

'Intialize MAX Update Order & Transaction DLLs
Dim datapath As New StringBuilder("")
Dim apppath As New StringBuilder("")
Dim OH_Order32 As Integer = InitMAXOrder(datapath, apppath)

... a bunch of code goes here that was removed for space in this message....

' Shutdown max
Dim iRet As Integer
iRet = ShutdownMAXOrder(OH_Order32)

' Return the sales order number
Return RetOrder
End Function

End Class
 
R

Rick Mogstad

James Radke said:
Can anyone help me out and tell me why this web application is freezing? What security will I
need on the BTRIEVE data directory to >allow the web application to access it?


You will probably need write security set for the ASPNET user. You will also need to have
security set on the DLL file for that user as well.
 
J

James Radke

What does 'write security set for the aspnet user', and "security set on the
dll for that user" mean? Is this just setting permissions on the
file/directories? Do you have any reference information you can point me
to?

Thanks!

Jim
 
R

Rick Mogstad

James Radke said:
What does 'write security set for the aspnet user', and "security set on the
dll for that user" mean? Is this just setting permissions on the
file/directories? Do you have any reference information you can point me
to?

Thanks!

Jim


there is a windows user setup on your system called ASPNET. You will need to set windows file
permissions on the dll and the database file(s) so that that user has permission to access them.
 
J

James Radke

Rick,

I have changed all the security for:

1.) the DLL directory
2.) the pervasive directory
3.) the data directory

to only have: EVERYONE - All access. So, I don't think it is a security
issue. If it was simply a security issue, wouldn't I get a security
violation from my try catch?

Any other ideas?

Thanks!

Jim
 
J

James Radke

Also, doing further testing with my PC based application; it appears that a
windows application is started (as a splash screen pops up for a second and
then disappears) when the call is performed. Could this be somehow causing
my web based application to have some problem?

Thanks!

Jim
 
R

Rick Mogstad

James Radke said:
Also, doing further testing with my PC based application; it appears that a
windows application is started (as a splash screen pops up for a second and
then disappears) when the call is performed. Could this be somehow causing
my web based application to have some problem?

Thanks!

Jim


Perhaps, its hard to say. Have you contacted the supplier of the dll to see if it was meant to be
used with WebForms, or whether there was anything specifically done to prevent it?
 
J

James Radke

Rick,

I have tried... but the companies tech support is, shall we say, less than
technical....... Just trying to get ahold of someone is virtually
impossible; and then they are not the most knowledgeable.

I hate it when I get so close, and then hit the brick wall......

Jim
 
P

Peter Huang

Hi James,

It seems that InitMAXOrder method will do some GDI operation which can not
be done in the Webform.
(as a splash screen pops up for a second and then disappears)

Based on my experience, you can not do the GDI operation on the Webform, it
is an HTML page in client side.
I think you may contact your vendor for more information.

If you have any concern on this issue, please post here.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

James Radke

Hi Peter.

What do you mean by GDI operation, I am not familiar with that term and what
it means? Shouldn't you be able to do any operation inside of a
code-behind; since it is running on your physical windows server, that you
can perform from a windows based vb.net application?

Thanks!

Jim
 
P

Peter Huang

Hi Jim,

I am sorry if I did not make clarification.
Since ASP.NET service runs as a service, it can not interactive with the
desktop. So we do not know what will happen if you let a dll working in
an window application work under the webform.

The GDI operation I mean is the similar with what you do with the windows
application. e.g. create a dialog(splash window). When do the similar stuff
in the severside of the ASP.NET application, its behavior is unexpected.

The senario is similar with you automation office in serverside.
Here is an article, you may take a look.

INFO: Considerations for Server-Side Automation of Office
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:
80/support/kb/articles/Q257/7/57.asp&NoWebContent=1

If you have any concern on this issue please post here.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top