public async Task WriteResponseAsync(HttpResponseWriterContext context)
        {
            var response = (HtmlResponse)context.Response;

            context.HttpResponse.ContentType = "text/html";
            await context.HttpResponse.WriteAsync(response.Html);
        }
        public async Task WriteResponseAsync(HttpResponseWriterContext context)
        {
            var response = (SvgResponse)context.Response;

            context.HttpResponse.ContentType = "image/svg+xml";
            await context.HttpResponse.WriteAsync(response.Svg);
        }
예제 #3
0
        public async Task WriteResponseAsync(HttpResponseWriterContext context)
        {
            var    response = (IClaimsResponse)context.Response;
            string claimsString;
            string responseString;

            context.HttpResponse.ContentType = "application/json; charset=utf-8";
            using (var stringWriter = new StringWriter())
            {
                jsonSerializer.Serialize(stringWriter, response.GetClaims());
                claimsString = stringWriter.ToString();
            }
            using (var stringWriter = new StringWriter())
            {
                jsonSerializer.Serialize(stringWriter, response.GetResponse());
                responseString = stringWriter.ToString();
            }

            context.HttpResponse.Cookies.Append("X-Auth", claimsString);
            await context.HttpResponse.WriteAsync(responseString);
        }