Revenj.Http.HttpSocketContext.ReturnError C# (CSharp) Method

ReturnError() private method

private ReturnError ( Socket socket, int status ) : bool
socket Socket
status int
return bool
        internal bool ReturnError(Socket socket, int status)
        {
            ReturnError(socket, status, null, false);
            return false;
        }

Same methods

HttpSocketContext::ReturnError ( Socket socket, int status, string message, bool withHeaders ) : void

Usage Example

Example #1
0
        private void LogError(Socket socket, HttpSocketContext ctx, Exception ex)
        {
            var sex = ex as SecurityException;
            var ans = ex as ActionNotSupportedException;

            if (sex != null)
            {
                try { ctx.ReturnError(socket, (int)HttpStatusCode.Forbidden, sex.Message, true); }
                catch (Exception e)
                {
                    TraceSource.TraceEvent(TraceEventType.Error, 5404, "{0}", e);
                }
            }
            else if (ans != null)
            {
                try { ctx.ReturnError(socket, 404, ans.Message, true); }
                catch (Exception e)
                {
                    TraceSource.TraceEvent(TraceEventType.Error, 5404, "{0}", e);
                }
            }
            else
            {
                TraceSource.TraceEvent(TraceEventType.Error, 5403, "{0}", ex);
                try { ctx.ReturnError(socket, 500, ex.Message, false); }
                catch (Exception ex2)
                {
                    TraceSource.TraceEvent(TraceEventType.Error, 5404, "{0}", ex2);
                }
            }
        }
All Usage Examples Of Revenj.Http.HttpSocketContext::ReturnError