Improve this Doc View Source

Class HttpListenerContextExtensions

Extensions for the HttpListener

Inheritance
System.Object
HttpListenerContextExtensions
Namespace:Dapplo.HttpExtensions.Listener
Assembly:Dapplo.HttpExtensions.dll
Syntax
public class HttpListenerContextExtensions

Methods

| Improve this Doc View Source

RespondAsync<TContent>(HttpListenerContext, TContent, CancellationToken)

This writes the supplied content to the response of the httpListenerContext It's actually a bit overkill, as it convers to HttpContent and writes this to a stream But performance and memory usage are currently not our main concern for the HttpListener

Declaration
public static Task RespondAsync<TContent>(HttpListenerContext httpListenerContext, TContent content, CancellationToken token = null)where TContent : class
Parameters
Type Name Description
System.Net.HttpListenerContext httpListenerContext

HttpListenerContext

TContent content

TContent object

System.Threading.CancellationToken token

CancellationToken

Returns
Type Description
System.Threading.Tasks.Task

Task