Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component


Index of Chilkat Blog Posts

August 29, 2007

How to Pipe CGI Output to ASP

This has nothing to do with Chilkat, but I thought it might be of interest to others.

This example demonstrates how to run a .exe from an ASP script, and pipe the output back to ASP.
Here’s the ASP script:

<html>
<body bgcolor="#FFFFFF">
<p>
<%
dim Shell
set Shell = CreateObject("wscript.shell")
	
Dim Pipe
set Pipe = Shell.Exec(Server.MapPath("/cgi-bin/HelloWorld.exe"))
	
do while(not Pipe.StdOut.AtEndOfStream)
   Response.Write(Pipe.StdOut.ReadLine())
loop
	
%>
</p>
</body>
</html>

The HelloWorld.exe program is this C++ program:

int main(int argc, char* argv[])
{
	printf("Hello World!\n");
	return 0;
}

You can test it live here:
http://www.chilkatsoft.com/pipeCgi.asp

It’s also possible to pass command line arguments to the CGI program.


Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.