Class HttpListenerRequest
Describes an incoming HTTP request to an HttpListener object.
public class HttpListenerRequest
- Inheritance
-
HttpListenerRequest
- Inherited Members
- Extension Methods
Remarks
When a client makes a request to a Uniform Resource Identifier (URI)
handled by an
The
To reply to the request, you must get the associated response using the Response property.
Properties
AcceptTypes
Gets the MIME types accepted by the client.
public string[] AcceptTypes { get; }
Property Value
- string[]
A
String array that contains the type names specified in the request's Accept header, or a null reference if the client request did not include an Accept header.
ContentLength64
Gets the length of the body data included in the request.
public long ContentLength64 { get; }
Property Value
- long
The value from the request's Content-Length header. This value is -1 if the content length is not known.
Remarks
The Content-Length header expresses the length, in bytes, of the body data that accompanies the request. enumeration.
ContentType
Gets the MIME type of the body data included in the request.
public string ContentType { get; }
Property Value
- string
A
String that contains the text of the request's Content-Type header.
Credentials
Return NetworkCredential if user have send user name and password.
public NetworkCredential Credentials { get; }
Property Value
Headers
Gets the collection of header name/value pairs sent in the request.
public WebHeaderCollection Headers { get; }
Property Value
- WebHeaderCollection
A
WebHeaderCollection that contains the HTTP headers included in the request.
HttpMethod
Gets the HTTP method specified by the client.
public string HttpMethod { get; }
Property Value
- string
A
String that contains the method used in the request.
InputStream
Gets a stream that contains the body data sent by the client.
public Stream InputStream { get; }
Property Value
- Stream
A readable
Stream object that contains the bytes sent by the client in the body of the request. This property returnsNull if no data is sent with the request.
IsAuthenticated
Gets a Boolean value that indicates whether the client sending this request is authenticated.
public bool IsAuthenticated { get; }
Property Value
- bool
Because authentication is not supported, returns
false .
Remarks
Because authentication is not supported, returns
KeepAlive
Gets a bool value that indicates whether the client requests a persistent connection.
public bool KeepAlive { get; }
Property Value
- bool
true if the connection should be kept open; otherwise,false .
Remarks
This property is set during parsing of HTTP header.
LocalEndPoint
Gets the server IP address and port number to which the request is directed. Not currently supported.
public IPEndPoint LocalEndPoint { get; }
Property Value
- IPEndPoint
An
IPEndPoint that represents the IP address that the request is sent to.
ProtocolVersion
Gets the HTTP version used by the requesting client.
public Version ProtocolVersion { get; }
Property Value
- Version
A
Version that identifies the client's version of HTTP.
Remarks
The capabilities of different HTTP versions are specified in the documents available at http://www.rfc-editor.org.
RawUrl
Gets the URL information (without the host and port) requested by the client.
public string RawUrl { get; }
Property Value
- string
A
String that contains the raw URL for this request.
Remarks
This URL information is the URL requested in the first request line.
RemoteEndPoint
Gets the client IP address and port number from which the request originated.
public IPEndPoint RemoteEndPoint { get; }
Property Value
- IPEndPoint
An
IPEndPoint that represents the IP address and port number from which the request originated.
Url
Gets the Uri object requested by the client. Not currently supported.
public Uri Url { get; }
Property Value
UserAgent
Gets the user agent presented by the client.
public string UserAgent { get; }
Property Value
- string
A
String object that contains the text of the request's User-Agent header.
UserHostAddress
Gets the server IP address and port number to which the request is directed.
public string UserHostAddress { get; }
Property Value
- string
A
String that contains the host address information.
UserHostName
Gets the DNS name and, if provided, the port number specified by the client.
public string UserHostName { get; }
Property Value
- string
A String value that contains the text of the request's Host header.
UserLanguages
Gets the natural languages that are preferred for the response.
public string[] UserLanguages { get; }
Property Value
- string[]
A
String array that contains the languages specified in the request'sAcceptLanguage header, ornull if the client request did not include anAcceptLanguage header.
Methods
Reset()
public void Reset()