sandycrum
22nd February 2005, 23:13
Hi,

I am asking for your help. We run Baan IVc4 with Informix database on HPUX. I am a developer that has done some OLE work with Baan and Excel using their samples to pass a concatenated string to a Baan dll. I have some limited experience with Web programming.

What I need to do is create a small web application using ASP.net and C# to pass the same concatenated string to the Baan dll. Since I was already familiar with the VBA code used in the Excel stuff, I decided to try and get that same logic to work in my Visual Studio Web app.

I have setup a working web app on my PC with IIS. I have added a reference to the Baan4.tlb file, which Visual Studio has copied to my project bin folder as interop.baan4.dll I assume for the COM wrapper functionality.

I can start and run my web app without any reference to Baan OK - but when I add a statement to create the Baan object:
Baan4Class connectBaan=new Baan4.Baan4Class();

I get errors indicating the call to the server failed and all stops:
System.Runtime.InteropServices.COMException: Server execution failed

I do not have enough experience with this stuff to figure out what is wrong. I have been taking the trial and error approach for the last several days and looking at vast lists of googled searches without great success.

Can someone give me a heads up or script that will work - or is this a lost cause? The lack of information about this has me worried.

Thanks in advance for any help that can be offered.

mark_h
25th February 2005, 00:12
Have you searched the board? I did this search (http://www.baanboard.com/baanboard/search.php?searchid=71251) and found some posts. You might try a PM to pedromrs - it looks like he mentioned that he has used C# and ASP.NET.

Good Luck!

Mark

sandycrum
25th February 2005, 01:25
Thanks for the feedback. I had searched the site many times in different ways - primarily with results referencing VB or there had been no response to the requester. I was not sure about etiquette in contacting anyone on this board directly with PM - so although I saw pedromrs response, I did not try to contact directly.

However, due to a very timely .net security seminar I attended yesterday, I now know that the web.config file of an ASP.NET project and the way the virtual folder permissions are setup is what was causing my problem, it was not due to the c# code. The "impersonate" parameter and removing anonymous user default allowed the Baan bw to use its known user not the one asp.net was passing.

Now, using your search link and sending the spanish language thread to a translator site - it seems dorleta had the answer. I should not have limited my searches to English it seems.

I appreciate your help on my first time of posting.

~Vamsi
25th February 2005, 08:06
Sandy,

I am glad you perservered and got a solution. Would you be willing to post some sample C# code that shows a sample Baan connection.

gous99
4th March 2005, 13:44
Hi sandycrum,

I have the same problem you had, can you specify how you set the changes required for this to work.

""The "impersonate" parameter and removing anonymous user default allowed the Baan bw to use its known user not the one asp.net was passing.""

Where is that impersonate parameter and how do we set it, and what do you mean by the anonymous user default?

Thanks in advance.

sandycrum
4th March 2005, 16:14
After some "trial and error", I figured out that the virtual folder settings really did not have to be changed. The real solution is to add the impersonate statement to the web.config file - which is part of your asp.net solution.

Example:
<!-- IDENTITY ATTRIBUTES
Impersonate Windows User -
impersonate="[true|false]" (default is false)
userName="Windows user account to impersonate"
(empty string implies impersonate the LOGON user specified by IIS)
password="password of above specified account"
-->
<identity impersonate="true" userName="" password=""/>

The code then for creating the Baan object and executing a function call is:

Baan4Class connectBaan=new Baan4.Baan4Class();
connectBaan.ParseExecFunction("aBaanDllName",@"theBaanFunctionCall(""withOptParms"")");
connectBaan.Quit();

I am still experimenting - on my PC. I have not yet moved this to our server and tried it. However, my expectation is it will work OK as long as we have the Baan client installed on it. My plan is to save the password in the bw file so the login prompt does not show up on the server and cause it to hang there.