« Previous Next »

Thread: CGI application in C#

Last post 04-08-2009 1:32 AM by Dmitry.K. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 04-07-2009, 9:33 PM

    • Dmitry.K
    • Not Ranked
    • Joined on 04-07-2009, 9:04 PM
    • Posts 3

    CGI application in C#

     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>");

  • 04-07-2009, 9:58 PM In reply to

    Re: CGI application in C#

     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
    www.iis-aid.com
    My IIS articles
    My PHP articles
    My How-to guides
  • 04-08-2009, 1:10 AM In reply to

    • Dmitry.K
    • Not Ranked
    • Joined on 04-07-2009, 9:04 PM
    • Posts 3

    Re: CGI application in C#

    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 :)

  • 04-08-2009, 1:32 AM In reply to

    • Dmitry.K
    • Not Ranked
    • Joined on 04-07-2009, 9:04 PM
    • Posts 3

    Re: CGI application in C#

    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"); 


Page 1 of 1 (4 items)
Microsoft Communities