System.Net.HttpStatusDescription.Get C# (CSharp) Method

Get() static private method

static private Get ( HttpStatusCode code ) : string
code HttpStatusCode
return string
        internal static string Get(HttpStatusCode code)
        {
            return Get((int)code);
        }

Same methods

HttpStatusDescription::Get ( int code ) : string

Usage Example

Esempio n. 1
0
        public void SendError(string msg, int status)
        {
            try
            {
                HttpListenerResponse response = _context.Response;
                response.StatusCode  = status;
                response.ContentType = "text/html";
                string description = HttpStatusDescription.Get(status);
                string str;
                if (msg != null)
                {
                    str = string.Format("<h1>{0} ({1})</h1>", description, msg);
                }
                else
                {
                    str = string.Format("<h1>{0}</h1>", description);
                }

                byte[] error = _context.Response.ContentEncoding.GetBytes(str);
                response.Close(error, false);
            }
            catch
            {
                // response was already closed
            }
        }
All Usage Examples Of System.Net.HttpStatusDescription::Get
HttpStatusDescription