Here's an example of how to create an HTTP server in C# that reads the request body as HTML:
main.cs1379 chars41 linesIn this example, we create an HttpListener that listens for requests on http://localhost:8080/. When a request is received, we get the context and request objects. We check if the request has an entity body (i.e., a request with a POST or PUT method that sends data in the request body). If it does, we read the request body using a StreamReader and print it to the console.
We then create an HttpListenerResponse and set the response body to a simple HTML string. Finally, we write the response to the output stream and close it. This is just a basic example, but it can be easily modified to handle more complex requests and responses.
gistlibby LogSnag