Owin.Response.Write C# (CSharp) Method

Write() public method

public Write ( string writeToBody ) : Response
writeToBody string
return Response
        public Response Write(string writeToBody)
        {
            BodyText += writeToBody;
            return this;
        }

Usage Example

Example #1
0
        public Task Invoke(IDictionary<string, object> env)
        {
            var request = new Request(env);
            var response = new Response(env)
            {
                ContentType = "text/html",
            };
            var wilson = "left - right\r\n123456789012\r\nhello world!\r\n";

            var href = "?flip=left";
            if (request.Query["flip"] == "left")
            {
                wilson = wilson.Split(new[] {System.Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)
                    .Select(line => new string(line.Reverse().ToArray()))
                    .Aggregate("", (agg, line) => agg + line + System.Environment.NewLine);
                href = "?flip=right";
            }

            return TimerLoop(350, 
                () => response.Write("<title>Hutchtastic</title>"),
                () => response.Write("<pre>"), 
                () => response.Write(wilson), 
                () => response.Write("</pre>"), 
                () =>
                {
                    if (request.Query["flip"] == "crash")
                    {
                        throw new ApplicationException("Wilson crashed!");
                    }
                }, 
                () => response.Write("<p><a href='" + href + "'>flip!</a></p>"),
                () => response.Write("<p><a href='?flip=crash'>crash!</a></p>"));
        }
All Usage Examples Of Owin.Response::Write