Exemple #1
0
        /// <summary>
        /// Enters the tree, onwards!
        /// </summary>
        /// <param name="context">Context.</param>
        void EnterTree(HttpListenerContext context)
        {
            HttpInteraction parameters = new HttpInteraction(
                context.Request, context.Response);

            try
            {
                if (Process(parameters))
                {
                    parameters.FlushBuffer();
                }
                else
                {
                    context.Response.StatusCode = 500;
                }
            }
            catch (Exception ex)
            {
                Secretary.Report(5, "Unhandled fault occurred near the server", ex.Message);
                Secretary.Report(7, ex.ToString());
            }

            try
            {
                parameters.IncomingBody.Close();
            }
            catch (Exception ex)
            {
                Secretary.Report(5, "Failure to close incoming stream", ex.Message);
            }

            try
            {
                parameters.OutgoingBody.Close();
            }
            catch (Exception ex)
            {
                Secretary.Report(5, "Failure to close outgoing stream", ex.Message);
            }
        }