Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void WriteErrorResponse(System.Net.HttpStatusCode code, string text)
- {
- HttpRequest req = new HttpRequest();
- req.StatusCode = code;
- var str = "<html><body><h1>" + ((int)code).ToString("D3") + " - " + code.ToString() + "</h1><br/>";
- str += text + "</body></html>";
- var bytes = Encoding.UTF8.GetBytes(str);
- req.ResponseStream.Write(bytes, 0, bytes.Length);
- req["Content-Length"] = bytes.Length;
- req["Connection"] = "close";
- Send(req);
- }
Advertisement
Add Comment
Please, Sign In to add comment