Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1249
  • Last Modified:

Call a VB Exe from a web page

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
Sethi
Asked:
Sethi
  • 6
  • 5
  • 3
  • +3
3 Solutions
 
ZylochCommented:
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
 
MattiCommented:
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
 
SethiAuthor Commented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
inthedarkCommented:
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
 
David LeeCommented:
"The application involves many forms ..."
Does the user have to interact with the forms?  
0
 
SethiAuthor Commented:
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
 
inthedarkCommented:
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
 
SethiAuthor Commented:
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
 
SethiAuthor Commented:
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
 
David LeeCommented:
If the program needs to be very interactive, then the DLL approach is probably the best.
0
 
EDDYKTCommented:
>>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
 
EDDYKTCommented:
Use ADCLaunch if and only if you use RDS
0
 
inthedarkCommented:
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
 
SethiAuthor Commented:
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
 
inthedarkCommented:
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
 
SethiAuthor Commented:
Thank you everybody for this help.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 5
  • 3
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now