Home
32 Bit dBase
Misc.
Links
Contact

Subject: Program that Shows all environmental variables on web server or local
Date: Tuesday, February 19, 2002 7:28 PM


This is a program that when compiled and run on a web server it will
show all environmental variables.
It uses Windows Scripting Host so we are able to return every
environmental variable not just the ones we know about.

You can even run it on your local machine without it being on a server
and it will create an HTML file instead of going to StdOut so you could
also see all your local variables.

You must have dB2K 0.4 or better for the error routines. Or you could
also modify the code for try/catch routines if you don't have dB2k .4

Download prg file here

Subject: Re: Program that Shows all environmental variables on web server or local
Date: Thursday, March 21, 2002 11:29 AM

Below is a CLASSified version, perhaps a bit more versatile.
Download Zip file here

Thank again Bowen,

I think perhaps, some users may not realize what a great help something
like this is in debugging web apps.
In your try, catch for your app you can do something like this:
try
... your web app code here
catch(exception e)
ShowEnv(oCgi)
oCgi.errorPage(e)
endtry

Since you are still connected though oCgi, you would see the
Environment that leads to your error from oCgi.errorPage(e)
Everything displayed nicely one after the other on the same page
Nice...
Rich...


function ShowEnv(oCgi)
set procedure to Environment.Cc additive
#define ENV_SYSTEM 1
#define ENV_PROCESS 2
#define ENV_USER 3
#define ENV_VOLATILE 4
oEnv = new Environment()
oEnv.GetEnvironment( ENV_PROCESS )
oCgi.fOut.puts('Content-type: text/html')
oCgi.fOut.puts('')
oCgi.fOut.puts('<html>')
oCgi.fOut.puts('<body>')
oCgi.fOut.puts('<h3>CGI PROCESS ENVIRONMENT VARIABLES</h3>')
oCgi.fOut.puts('<table border="1" cellpadding="2">')
cKey = oEnv.firstKey
for i = 1 to oEnv.count()
oCgi.fOut.puts('<tr>')
oCgi.fOut.puts(' <td>' + cKey + '</td>')
oCgi.fOut.puts(' <td>' + oEnv[cKey] + "</td>")
oCgi.fOut.puts('</tr>')
cKey = oEnv.nextKey( cKey )
next
oCgi.fOut.puts('</table>')
oCgi.fOut.puts('</body>')
oCgi.fOut.puts('</html>')
return