We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

CGI application in C# [Answered]RSS

3 replies

Last post Apr 08, 2009 01:32 AM by Dmitry.K

  • CGI application in C#

    Apr 07, 2009 09:33 PM|Dmitry.K|LINK

     Hi All!

    I have a problem with my CGI application written in C#. The problem is that IE attempt to download the content which generates the CGI as a file, however firefox are show this content as the web-page. It looks like IE needs special set of HTTP headers or something like this. Does anybody know what a problem?

     My C# code that generates content

     Console.WriteLine("HTTP/1.0 200 OK");
     Console.WriteLine("Content-type: text\\html");
     Console.WriteLine("");
     Console.WriteLine("<html><body><h1>CGI TEST</h1></body></html>");

    CGI application IE C#

  • Re: CGI application in C#

    Apr 07, 2009 09:58 PM|brashquido|LINK

     Sounds like a mime type issue. I can remember coming across something very similar to this a few years ago, but can't remember off the top of my head how I solved it. May have been as simple as setting the mime type for the exe extension for the website in question. I'll see if I can dig anything up.

    ----------------
    Dominic Ryan
    Microsoft IIS MVP
    IIS Aid
    IIS and Open Source
  • Re: CGI application in C#

    Apr 08, 2009 01:10 AM|Dmitry.K|LINK

    Thank you. I have found the bug

    Instead of

    Console.WriteLine("Content-type: text\\html");

    must be

    Console.WriteLine("Content-type: text/html"); 

    Realy simple :)

  • Re: CGI application in C#

    Apr 08, 2009 01:32 AM|Dmitry.K|LINK

    Dmitry.K

     Hi All!

    I have a problem with my CGI application written in C#. The problem is that IE attempt to download the content which generates the CGI as a file, however firefox are show this content as the web-page. It looks like IE needs special set of HTTP headers or something like this. Does anybody know what a problem?

     My C# code that generates content

     Console.WriteLine("HTTP/1.0 200 OK");
     Console.WriteLine("Content-type: text\\html");
     Console.WriteLine("");
     Console.WriteLine("<html><body><h1>CGI TEST</h1></body></html>");

     

     So, issue

    Instead of

    Console.WriteLine("Content-type: text\\html");

    must be

    Console.WriteLine("Content-type: text/html");