Ejemplo n.º 1
0
        private static string GetResponseStatus(httpStatus status)
        {
            switch (status)
            {
            case httpStatus.OK: return("200 OK");

            case httpStatus.NOTFOUND: return("404 Not Found");

            default: return("500 Server Err");
            }
        }
Ejemplo n.º 2
0
        public static string Generate(httpStatus httpStatus, List <ResponseExpansionModel> headList, int iTotBytes = 0, string content_Type = "text/html;", string httpVersion = "HTTP/1.1")
        {
            String sBuffer = "";

            sBuffer = sBuffer + httpVersion + " " + GetResponseStatus(httpStatus) + "\r\n";
            sBuffer = sBuffer + "Content-Type: " + content_Type + "\r\n";
            foreach (var tmp in headList)
            {
                sBuffer += tmp.Key + ": " + tmp.Value + "\r\n";
            }
            if (iTotBytes != 0)
            {
                sBuffer = sBuffer + "Content-Length: " + iTotBytes + "\r\n\r\n";
            }
            return(sBuffer);
        }