Help with CGI interpreter

N

Nurchi BECHED

Hello, ALL

These days, we see a lot of sites that use
and EXE or a DLL as a CGI application
(eg. http://domain.com/cgi-bin/program.exe?param1=value1&param2=value2...)

I found a lot of examples on how to do that with C#, but they all use
Apache server.

I want to go with IIS. I tried so many different things; it either
says that file is not found, or offers me to download that file.

The only way to achieve that in IIS, I found, was to create a new
extension in IIS virtual folder's properties, and assign my EXE to it.
Like ASP is interpreted by "C:\WINDOWS\system32\inetsrv\asp.dll,"
I have assigned NASP to "...\ConWebApp1.exe" and it seems to work.

BUT:

When I pass parameters "localhost/.../something.nasp?param1=value1"
it doesn't get the parameters through the "args" parameter of the Main
method, but it does through:
"System.Environment.GetEnvironmentVariable("QUERY_STRING")"

It gets me the whole string "param1=value1"

Now, I have decided to write a CGI interpreter (like ASP or PHP) lol

How can I get the "NASP" filename that is being called by the browser?
Is there any way to get the list of all environment variables?
(I tried, the code below compiles just fine, but I get an exception thrown
when I try to load the page)
foreach (System.Collections.IDictionary d in
System.Environment.GetEnvironmentVariables())
{
System.Collections.IDictionaryEnumerator id=
d.GetEnumerator();
Console.WriteLine(
"Key: "+id.Entry.Key.ToString()+"\r\n"+
"Value: "+id.Entry.Value.ToString());
}

And the last question, how would I handle POSTed data?
I mean if a web form uses POST method rather than GET.

I hope you didn't get bored while reading...

Any help is greatly appreciated.
Thanks in advance.
 
N

Nurchi BECHED

I don't know what's wrong, but I don't have
"System.Web.HttpApplication"

All I have is:
System.Web.AspNetHostingPermission
System.Web.AspNetHostingPermissionAttribute
System.Web.AspNetHostingPermissionLevel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top