Provides access to the request and response objects used by the HttpListener class. This class cannot be inherited.
Assembly: System (in System.dll)
This class provides the information related to a client's Hypertext Transfer Protocol (HTTP) request being processed by an HttpListener object. The GetContext method returns instances of the class. To get the object that represents the client request, use the Request property. To get the object that represents the response that will be sent to the client by the HttpListener, use the 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 IPrincipal object returned by the User property.
Closing an object sends the response to the client and frees any resources used by the . Aborting an object discards the response to the client if it has not already been sent, and frees any resources used by the . After closing or aborting an object, you cannot reference its methods or properties. If you do so, you will receive an ObjectDisposedException exception.
Windows XP Home Edition, Windows XP Professional x64 Edition, Windows Server 2003 Platform Note: Service pack 2 is required to use the HttpListener class.
The following code example displays the user information for a client request.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.