Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Content-type : text/html
Message
 
To
04/12/2004 10:52:57
General information
Forum:
ASP.NET
Category:
HTTP
Miscellaneous
Thread ID:
00966906
Message ID:
00966957
Views:
11
What are you trying to do exactly? Create a CGI style EXE?

Console doesn't have a Content Type property to start with. If you want to write output to StdOut you simply use Console.Write() and you must write out the content type header as text with Console.WriteLine() or the like.

FWIW, you'll also need a proper HTTP protocol header - content type alone is not an invalid header.

A proper HTTP response looks like this:
Console.Write(
@"HTTP/1.1 200 OK
Content-type: text/html

Response content goes here
");
+++ Rick ---

>Hi All,
>
>I am trying to set a HTTP header to "text/html" and I am having no joy.
>
>This is what I have so far... Am I far off? How can I do this?
>
>
>using System;
>
>class Hello
>{
>     static void Main()
>     {
>          Console.ContentType = "text/html";
>          Console.WriteLine("Hello World");
>     }
>}
>
>
>This is the c++ of what I want to do but in c#.
>
>
>#include <iostream.h>
>
>int main(){
>    cout << "Content-type: text/plain" << endl << endl
>    << "Hello World";
>}
>
>
>Can some-one please offer some help on this. It is really doing my head in.
>
>Thanks and Kind Regards,
>Tarran Walker
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform