Mike Broderick
asked on
IIS cgi visual basic .net console app, how to make a hit counter-like app
I am having problems making a simple cgi program work. The page waits for 20 seconds, then only displays Output from CGI:
Environment:
XP (SP3), IIS 5.1
Page T1.shtml:
<html><head><title>Test CGI</title></head>
<body>
<p>Output from cgi: <!--#exec cgi="/cgi-bin/T1.exe" --> </p>
</body></html>
Here is T1.exe, a compiled VS 2005 console app:
Sub Main()
Console.WriteLine("Hello, world!")
End Sub
(I apologize for dumping source, but this one is easier to list than explain)
I think I am close, if I add a mapping configuration entry to map .exe to aspnet_isapi.dll, I do get output that kinda looks like the binary program.
Can anybody see what I am doing wrong?
Also, please tell me if I am going about this all wrong. The purpose of the cgi is to select and insert images into html and simple asp pages (I only use asp to get the include feature). The program will be a complicated visual basic .net app, but the output will either be dumping the selected file or a links to it.
I used to write cgi code on other platforms. Hit counters (remember those things) were a common cgi app. You pass the page name as a parm and your program processed it (add a counter in a db rec) and optionally returned a string representation of a number. I also have written many aspx apps. I want to insert an image into pages that are maintained by an html editor.
Thank you.
Environment:
XP (SP3), IIS 5.1
Page T1.shtml:
<html><head><title>Test CGI</title></head>
<body>
<p>Output from cgi: <!--#exec cgi="/cgi-bin/T1.exe" --> </p>
</body></html>
Here is T1.exe, a compiled VS 2005 console app:
Sub Main()
Console.WriteLine("Hello, world!")
End Sub
(I apologize for dumping source, but this one is easier to list than explain)
I think I am close, if I add a mapping configuration entry to map .exe to aspnet_isapi.dll, I do get output that kinda looks like the binary program.
Can anybody see what I am doing wrong?
Also, please tell me if I am going about this all wrong. The purpose of the cgi is to select and insert images into html and simple asp pages (I only use asp to get the include feature). The program will be a complicated visual basic .net app, but the output will either be dumping the selected file or a links to it.
I used to write cgi code on other platforms. Hit counters (remember those things) were a common cgi app. You pass the page name as a parm and your program processed it (add a counter in a db rec) and optionally returned a string representation of a number. I also have written many aspx apps. I want to insert an image into pages that are maintained by an html editor.
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
does this mean that you want to write on STDOUT of the console window?
That most likely does not work in a web application on wndoze systems 'cause the web server has no console window.
You have to write to STDOUT of the program, which is then the response send to the browser.