Solved

Call a VB Exe from a web page

Posted on 2004-08-11
18
1,241 Views
Last Modified: 2008-02-01
I have created a VB exe that I would be storing in the server where I have hosted my site. Through a link from a asp page, I want the user to open that exe and pass some values to it. The exe will then perform some actions based upon those values and return the result to the user. Is this possible?

I forsee the following problems:
1. being an exe the IIS settings may not allow it to run on the server.
2. How can the user interact with the exe through a browser. possibly the browser will ask the user to download the exe at his/her machine.

Please advise.
0
Comment
Question by:Sethi
  • 6
  • 5
  • 3
  • +3
18 Comments
 
LVL 36

Assisted Solution

by:Zyloch
Zyloch earned 100 total points
Comment Utility
Hi

I don't thinks so, at least not in IE. There are strict security regarding these things, otherwise viruses would be able to go everywhere. The only thing I can see if for the user to download it, or create something like the exe in ASP, for instance.

Regards,
Zyloch
0
 
LVL 14

Expert Comment

by:Matti
Comment Utility
Why don't you make it as a ActiveX control.
If it's a single form program, it might be easy to convert as a control.

Matti
0
 
LVL 18

Author Comment

by:Sethi
Comment Utility
The application involves many forms and can not be made an ActiveX. Infact as I am not very good with ActiveX Controls, I would not like to venture into them at this stage of the project. There are approximately 10 forms in the application and the application.
0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
There are a number of ways:

Internet

1) Normally you would change the type of you project from a Standard EXE to an ActiveX DLL.  You make a public class that activaes your application. You create a little ASP paqe that creates an instance of your object.  You can then pass to your application the IIS objects that make life easy: Application, Session, Request & Response objects which are easy to use, that tell you what the client has ask for. You then send the clinet information via the response object.  It sounds hard but it is as easy as this:

response.write "<HTML><BODY>Hello World</BODY></HTML>

2) You can create a CGI EXE which is a standard exe program which when run by IIS uses the STDIN and STDOUT channels to decode the request data and send a response back to the client.  This type of EXE is quite envolved but not impossible.

Intrarnets (where all pc's running windows)

3) This option only works on intranets but is quite cool and very affective.  If you want to run the exe on the client system but have it load from a web page there is a cute trick you can do. You register an extension on the client system, say for exmple .SAR.  You can create a text file and rename it, say DoSomething.SAR.  In your text file you place instructions and data like FUNCTION X "\\serverx\data\myfile.xyz".  On the client you register the SAR extension to run an EXE which is loaded on your server.  You can either hard code the SAR files of generate them on the fly and then redirect the client to the file like: "http://serverx/Downloads/YourFunction.sar".  This method is very fast and the user does not see any delay, the exe file loads from the server and starts running.

4) Create a an ActiveX DLL which is registered on your server.  Create a TLB for the DLL which is registered on each client.  The client can link to a script that creates an object on the server.

Set MyObject = CreateObject("MyObject.MyCLass", "serverx")

You can now run methods and get results from the DLL/ or ActiveX EXE running on the server.

Results = MuObject.Run("Passing some data")

Which way do you want to go?
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
"The application involves many forms ..."
Does the user have to interact with the forms?  
0
 
LVL 18

Author Comment

by:Sethi
Comment Utility
From what I can understand from the above comments is that creating an exe would not be a straight solution. Fair enough. Let's say I drop the idea of full flegded application with 10 forms and create an ActiveX DLL which takes a few parameters from the user. Here are my questions related to it:

1. How will I call this DLL from my ASP page and pass the parameters to it. lets say that instead of creating a form in VB, i create a form in ASP with all required textboxes in it.
2. Is some special settings at IIS required to use this DLL?
0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
Another way is you have your exe bind to an ip address & port. Say port 81.  A client can the select a link like this: "Http://serverx/any stuff uou like here?morestuff=here&evenmore=here:81".

When this link is activated IIS is bypassed and your exe will get a connection request.  You accept the connection in an array of winsock controls. You then do the numbercrunching and create an http response string. Actually this way works about 2000 times faster than IIS.

0
 
LVL 18

Author Comment

by:Sethi
Comment Utility
BlueDevilFan, I was typeing the above comment when you posted your question. I actually need many parameters from the user in various textboxes and that I now think would be possible by creating the asp page itself. However, this data need to be passed to VB DLL. So we are now at a point where the interface will be in ASP and functionality will be performed in VB.
0
 
LVL 18

Author Comment

by:Sethi
Comment Utility
inthedark, the winsock solution looks very interesting. is is possible that the firewall may play a bad boy's role and not let the exe run?
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 76

Expert Comment

by:David Lee
Comment Utility
If the program needs to be very interactive, then the DLL approach is probably the best.
0
 
LVL 26

Assisted Solution

by:EDDYKT
EDDYKT earned 100 total points
Comment Utility
>>1. being an exe the IIS settings may not allow it to run on the server.
IIS allows you to run activex exe. You need to enable the AspAllowOutOfProcComponents flag and put your classname to registry key under
"HKLM\SYSTEM\CurrentControlSet\Services\w3svc\parameters\ADCLaunch"

To enable the flag
ie

    Dim IISComp
   
    On Error Resume Next
    Set IISComp = GetObject("IIS://localhost/W3svc")
    IISComp.Put "AspAllowOutOfProcComponents", True
    IISComp.SetInfo
    Set IISComp = Nothing


>>2. How can the user interact with the exe through a browser. possibly the browser will ask the user to download the exe at his/her machine.
You can start your exe from asp and use XML data island to pass the result back to client

0
 
LVL 26

Expert Comment

by:EDDYKT
Comment Utility
Use ADCLaunch if and only if you use RDS
0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
If you use option 3 above your exe will work as is. All you need to do is register the extension. But this only works in an intranet.

I think that converting a whole app from exe to a DLL that generates HTML is going to take a long time.
0
 
LVL 26

Expert Comment

by:EDDYKT
Comment Utility
0
 
LVL 18

Author Comment

by:Sethi
Comment Utility
I think I shall go by the DLL method as that looks the best in this situation. The site is hosted on a shared server and we do not have a say to get the IIS settings changed. I am sure DLL's must be used by other sites for some functionalities and IIS would allow that.

My only questions that remained unanswered are:
1. How will I call this DLL from my ASP page and pass the parameters to it. Lets say that instead of creating forms in VB, I create a form in ASP with all required textboxes in it and by pressing Submit, the Dll is called and all the values accepeted from the user arepassedto the DLL.
2. Is some special settings at IIS required to use this DLL?
0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
Firewalls can be a problem, if they are then you bind your normal web-site to say port 81 and you listen on port 80.  When you get an http request comming in you decode the request and if you don't recognize the document you just connect to port 81 and send the same data you got from the client.  When the response arrives you echo that back to the client.

Appart from the look of each form, your main conversion problem will be that your exe will want to process all events interactivly. Example say if you have a text box that has some code in a keypress event you have to find a way of doing that using (horrid) client-site scripting.  But a web-server app gets all of the data in one hit so needs to validate the whole screen and then accept thet data or redisplay.  So when you validate your fields you need to store which fields are wrong so that wen you display the results you can display error fields in say red.
0
 
LVL 17

Accepted Solution

by:
inthedark earned 300 total points
Comment Utility
0
 
LVL 18

Author Comment

by:Sethi
Comment Utility
Thank you everybody for this help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now