I have a problem with HttpListener, it works fine (including returning 404), but if I write something to the output stream (to return a custom html for 404), even if I set the status code = 404 firebug displays the status 200 ok as soon as i remove the custom html it sees 404 as expected.
How can I get 404 if I uncomment the two commented lines, I get the HTML that I want to display but 200, while I expect 404:
//var buffer = System.Text.Encoding.UTF8.GetBytes("<html><head></head><body><h1>404 not found</h1></body></html>"); //ctx.Response.OutputStream.Write(buffer, 0, buffer.Length); ctx.Response.StatusCode = 404;
source share