Compiling C# program with Request object
Hello all,
I want to write a little CGI program that I can run under IIS, and I'm some what stumped - here is what I have:
public class Test
{
static void Main()
{
Console.Write( "Content-type: text/html\n\n" );
System.Console.WriteLine( System.Web.HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"] );
}
}
Which is all well can good - it compiles with "gmcs -out:text.exe test.cs -r:System.Web". But then I transfer the .exe file to my Windows machine and try to run it as a CGI program I get:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
So the question is, how can I compile a C# application with Mono using the 'Request' object and have it available under a IIS CGI environment. Or should I be accessing the CGI variables in some different manner?
Thanks
Allan