[Mono-list] Compiling C# program with Request object

theallan allan.jardine at sprypanel.com
Wed Jul 9 17:17:48 EDT 2008


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
-- 
View this message in context: http://www.nabble.com/Compiling-C--program-with-Request-object-tp18371017p18371017.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list