public static TextWriter GetChunkedWriter(this IResponse response)
        {
            if (response.OriginalResponse is HttpResponse)
            {
                return(((HttpResponse)response.OriginalResponse).GetChunkedWriter());
            }
            if (response.OriginalResponse is HttpResponseBase)
            {
                return(((HttpResponseBase)response.OriginalResponse).GetChunkedWriter());
            }
            if (response.OriginalResponse is HttpListenerResponse)
            {
                return(((HttpListenerResponse)response.OriginalResponse).GetChunkedWriter());
            }

            throw new InvalidOperationException("Unknown response type.");
        }
 public override void OnFailedAuthentication(IAuthSession session, IHttpRequest httpReq, ServiceStack.ServiceHost.IHttpResponse httpRes)