Ejemplo n.º 1
0
 public static void SendDirectories(Stream stream, string dirs)
 {
     Header header = new ResponseHeader();
     byte[] response = Encoding.ASCII.GetBytes(dirs);
     header.SetHeader("ContentLength", response.Length.ToString());
     header.SetHeader("ContentType", @"text\html");
     SendContentHandler.SendHeader(header, stream);
     stream.Write(response, 0, response.Length);
 }
Ejemplo n.º 2
0
 public void SendErrorPage(Stream stream, int code)
 {
     ResponseHeader header = new ResponseHeader();
     using (StreamReader sr = new StreamReader(Statics.Root + @"/Errorpages/" + code + ".html"))
     {
         String line;
         String content = "";
         while ((line = sr.ReadLine()) != null)
         {
             content += line;
         }
         byte[] response = Encoding.ASCII.GetBytes(content);
         header.Status = code;
         header.SetHeader("ContentLength", response.Length.ToString());
         SendContentHandler.SendHeader(header, stream);
         stream.Write(response, 0, response.Length);
     }
 }