【发布时间】:2009-09-03 15:15:56
【问题描述】:
我的印象是我可以将任何旧的可执行程序放在 Apache 的cgi-bin 目录中,并将其用作 CGI 脚本。具体来说,如果我有一个 C# 程序
static class TestProg
{
static void Main(string[] args)
{
Console.Write("Content-type: text/plain\r\n\r\n");
Console.WriteLine("Arguments:");
foreach (string arg in args)
Console.WriteLine(arg);
}
}
然后转到http://example.com/cgi-bin/TestProg?hello=kitty&goodbye=world 然后查询字符串hello=kitty&goodbye=world 将作为第一个参数传递给main,所以我的页面应该是这样的
Arguments:
hello=kitty&goodbye=world
不幸的是,我的查询参数都没有被传递;页面加载并仅打印Arguments:,后面没有任何内容。
那么如何让我的查询参数传递给这个程序呢?
【问题讨论】:
标签: apache executable cgi-bin query-parameters