Provides access to the request and response objects used by the System.Net.HttpListener class. This class cannot be inherited.
See Also: HttpListenerContext Members
This class provides the information related to a client's Hypertext Transfer Protocol (HTTP) request being processed by an System.Net.HttpListener object. This class also has methods that allow an System.Net.HttpListener object to accept a WebSocket connection.
The HttpListener.GetContext method returns instances of the System.Net.HttpListenerContext class. To get the object that represents the client request, use the HttpListenerContext.Request property. To get the object that represents the response that will be sent to the client by the System.Net.HttpListener, use the HttpListenerContext.Response property. To get user information about the client sending the request, such as its login name and whether it has been authenticated, you can query the properties in the System.Security.Principal.IPrincipal object returned by the HttpListenerContext.User property.
Closing an System.Net.HttpListenerContext object sends the response to the client and frees any resources used by the System.Net.HttpListenerContext. Aborting an System.Net.HttpListenerContext object discards the response to the client if it has not already been sent, and frees any resources used by the System.Net.HttpListenerContext. After closing or aborting an System.Net.HttpListenerContext object, you cannot reference its methods or properties. If you do so, you will receive an ObjectDisposedException exception.