Calling asp code from desktop application

I need to call from desktop delphi application, an asp code that do some process in web server.
The idea is this. I do some process locally in desktop PC, exporting data to a ftp site. When this is finished, then i need to call an asp applet (something like this:\someprocess.asp) that work with the exported data.
Asp should run in an "invisible" navigator window or something like that, to prevent user to close that window, or app lose focus, until the process is fully terminated, then that window should be closed.
During the web processing, desktop application must continue normally... the user do not have to notice that the asp page is working in background.
I have this enviroment:
- Delphi 7
- Indy 10
Is this can be done?
Martin BarredaLic. in Computer ScienceAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>>I need to call from desktop delphi application, an asp code that do some process in web server
you mean you have .asp file locally on your disk and want run it in Delphi? if so then it's not possible

if you want to call\someprocess.asp just like you do with webbrowser then place TWebBrowser on your form and use WebBrowser1.Navigate('\someprocess.asp');

in case there is no need for a twebbrowser (like that page does not contain java script or an activex control or otehr stuff that need to be executed locally on the client) it is sufficient to just call:


(since you mentioned indy)

this will be less resource consuming for your app then using a twebbrowser :)
Martin BarredaLic. in Computer ScienceAuthor Commented:
I like more Ciuly's answer but... the form from where i make the call will be probably be closed just before the call was make... possible all application should be close, but i need someprocess still be executing until it ends.
someprocess.asp takes (lets say), 3 minutes to finished its work. It do not have activeX or any visible control. It is just a blind process that takes data in an MDB database and make individual semistatic pages.
Locally... the user do not have to notice that this is happening.
I really do not know, but i think that if browser window, or something like that, is closed before it finished, the process will not ends right... is that right?
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

actually no. the minute the browser window closes so does it's connection which will signal the webserver that the client closed which will signal teh appropriate payers about it thus leading to a dead end.

there are several solutions to this problem (consdiering that the processing you mention takes 3 minutes or more):
- if the program itself is not closed (only some form, and the program continues to run either in the background or having the main form visible), then you can use a thread to make the idhttp1.get call
- if the program does close, you have 2 options:
-- 1) don't close the program until the processing is finished (hide the forms and all that. but the user will still see the process in task manager IF he bothers to look there :) )
-- 2) create another process (shellexecute for example) which will run in the background, no forms, no nothing and will do the get call
- and finally, you could solve this on the server side by responding to the get with nothing (or bogus) and keeping the process on the server still running.
for example, you have a method somewhere which will start that lengthy process. don't do it right there, but instead start a new thread which will do that processing.

but I am afraid that further details on how to solve this server side depends  alot on what and how you are doing things server side.

in my opinion, this matter should be solved server side, as it is a server side processing which the client is not interested about so there is no sense in making it wait for it. so teh idhttp1.get will finish in a split of a second, while the server wil continue doing whatever it needs to do.
Martin BarredaLic. in Computer ScienceAuthor Commented:
Thinking on the 2 options that Ciuly offer...:
1) the alternative is passed to asp developer (other that me), and i am waiting for an answer. It seems the best choice... make the server do the work.
2) but if this can't be done (or if he don't want... :) ), there is my formerly idea... use shellexecute to call the default browser (firefox, opera, ie) or a minibrowser made by me to exec the process.
2.1) using the default browser, i have this problem, how can i make the open windows not visible, and then have the hiding process kill without user intervention. So that is my original question.
2.2) or, here is something new... i make a minibrowser... a form with some asp component?, that runs in system tray until it closes... or should i use only indy http get in that form as you say before?
2.1) it can be done but it's a little tricky. I think just passing sw-Hide as the showing parameter or what's its name shoudl do it (I don't have an IDE handy to check). if it doesn't, then you will have to use createprocess(ex?) and there you have alot more control over the process, including it's PID (which you will use to kill it with). using shellexecute will need you to dig through the windows to find the process which is a little dirty. so in this case, createprocess(ex?) is better
2.2) this idea would be even better the 2.1 because you will not have to kill that process in case you will need it to get many times that url (or other urls). so you keep it running in the background, use a sharedmemory to pass the data (the url) to it, and then that helper process will create a thread to deal with the url. indy should be sufficient since there is no active script/control to be executed.

note that background process does not mean system tray :) although you can have it sit in the system tray but that willd efinetly raise teh users question: what's that running in my system tray? :)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Martin BarredaLic. in Computer ScienceAuthor Commented:
Just for the record... 2.2 is what is running by now.
Using ShellExecute(handle, 'open', FullFileNameOfMyAppWithoutAnyFormsOrResource, DirOfASPCode, nil, SW_SHOWNA).
The application, just did something like this (i do not have it by hand now)... in app source code, and no more.
  MyidHTTP := TidHTTP.Create(nil);
//idHTTP of Indy 10
//0 = FullFileNameOfMyAppWithoutAnyFormsOrResource

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.