Skip to main content

HttpWebRequest Class

Namespace: System.Net · Assembly: GHIElectronics.TinyCLR.Networking.Http

Provides an HTTP-specific implementation of the System.Net.WebRequest class.

public class HttpWebRequest : WebRequest

Properties

Timeout

public override int Timeout { get; set; }

Gets or sets the timeout value in milliseconds for the System.Net.HttpWebRequest.GetResponse and System.Net.HttpWebRequest.GetRequestStream methods.

Credentials

public NetworkCredential Credentials { get; set; }

Set or Get NetworkCredential if user have send user name and password.

HttpsAuthentCerts

public X509Certificate[] HttpsAuthentCerts { get; set; }

Gets or sets the array of certificates used to authenticate https servers. These certificates are used only for https connections; http connections do not require them.

ReadWriteTimeout

public int ReadWriteTimeout { get; set; }

Gets or sets a timeout in milliseconds when writing to or reading from a stream.

RequestUri

public override Uri RequestUri { get; }

Gets the original Uniform Resource Identifier (URI) of the request.

Address

public Uri Address { get; }

Gets the URI for this request.

AllowWriteStreamBuffering

public bool AllowWriteStreamBuffering { get; set; }

Gets or sets a value that indicates whether to buffer the data sent to the Internet resource.

ContentLength

public override long ContentLength { get; set; }

Gets or sets the Content-Length of the request entity body.

ContinueDelegate

public HttpContinueDelegate ContinueDelegate { get; set; }

Gets or sets the delegate used to signal on Continue callback.

AllowAutoRedirect

public bool AllowAutoRedirect { get; set; }

Gets or sets a value that indicates whether the request should follow redirection responses.

MaximumAutomaticRedirections

public int MaximumAutomaticRedirections { get; set; }

Gets or sets the maximum number of redirects that the request follows.

Connection

public string Connection { get; set; }

Gets or sets the value of the Connection HTTP header.

Host

public string Host { get; set; }

Gets or sets the value of the Host HTTP header.

Date

public DateTime Date { get; set; }

Gets or sets the Date HTTP header.

MediaType

public string MediaType { get; set; }

Gets or sets the media type of the request.

Method

public override string Method { get; set; }

Gets or sets the HTTP method of this request.

KeepAlive

public bool KeepAlive { get; set; }

Gets or sets whether to use a persistent connection, if available.

MaximumResponseHeadersLength

public int MaximumResponseHeadersLength { get; set; }

Gets or sets the maximum allowed length of the response headers.

DefaultMaximumResponseHeadersLength

public static int DefaultMaximumResponseHeadersLength { get; set; }

Gets or sets the default maximum allowed length of the response headers.

Headers

public override WebHeaderCollection Headers { get; set; }

A collection of HTTP headers stored as name/value pairs.

Proxy

public override IWebProxy Proxy { get; set; }

Gets or sets the proxy for the request.

SendChunked

public bool SendChunked { get; set; }

Gets or sets the state of chunk transfer send mode.

ProtocolVersion

public Version ProtocolVersion { get; set; }

Gets or sets the HTTP protocol version for this request.

ContentType

public override string ContentType { get; set; }

Gets or sets the type of the entity body (the value of the content type).

TransferEncoding

public string TransferEncoding { get; set; }

Gets or sets the TransferEncoding HTTP header.

Accept

public string Accept { get; set; }

Gets or sets the value of the Accept HTTP header.

Referer

public string Referer { get; set; }

Gets or sets the value of the Referer HTTP header.

UserAgent

public string UserAgent { get; set; }

Gets or sets the value of the User-Agent HTTP header.

Expect

public string Expect { get; set; }

Gets or sets the value of the Expect HTTP header.

IfModifiedSince

public DateTime IfModifiedSince { get; set; }

Gets the IfModifiedSince value of HttpKnownHeaderNames .

HaveResponse

public bool HaveResponse { get; }

Gets whether a response has been received from an Internet resource.

Methods

Dispose(bool disposing)

protected override void Dispose(bool disposing)

Closes a response stream, if present.

ParameterTypeDescription
disposingboolNot used.

Abort()

public override void Abort()

Cancels a request to an Internet resource. Closes any open request/response stream and releases the underlying socket. Subsequent calls to GetResponse / GetRequestStream on this instance throw.

Reset()

public void Reset()

Sets the enumerator to its initial position, which is before the first element in the collection. (inherited)

AddRange(int from, int to)

public void AddRange(int from, int to)

Adds a byte range header to the request for a specified range.

ParameterTypeDescription
fromintThe start of the range.
tointThe end of the range.

AddRange(int range)

public void AddRange(int range)

Adds a range header to a request for a specific range from the beginning or end of the requested data.

ParameterTypeDescription
rangeintStart of the range. The end of the range is the end of the existing data.

AddRange(string rangeSpecifier, int from, int to)

public void AddRange(string rangeSpecifier, int from, int to)

Adds a range header to a request for a specified range.

ParameterTypeDescription
rangeSpecifierstringThe description of the range, such as "bytes".
fromintThe start of the range.
tointThe end of the range.

AddRange(string rangeSpecifier, int range)

public void AddRange(string rangeSpecifier, int range)

Adds a range header to a request for a specific range from the beginning or end of the requested data.

ParameterTypeDescription
rangeSpecifierstringThe description of the range, such as "bytes".
rangeintThe range value.

AddRange(long from, long to)

public void AddRange(long from, long to)

Adds a byte range header for ranges that may exceed Int32.MaxValue.

ParameterTypeDescription
fromlong
tolong

AddRange(long range)

public void AddRange(long range)

Adds a byte range header for a range that may exceed Int32.MaxValue.

ParameterTypeDescription
rangelong

AddRange(string rangeSpecifier, long from, long to)

public void AddRange(string rangeSpecifier, long from, long to)

Adds a range header to a request for a specified range, with long endpoints.

ParameterTypeDescription
rangeSpecifierstring
fromlong
tolong

AddRange(string rangeSpecifier, long range)

public void AddRange(string rangeSpecifier, long range)

Adds a range header to a request from the beginning or end of the data, with a long range value.

ParameterTypeDescription
rangeSpecifierstring
rangelong

GetResponse()

public override WebResponse GetResponse()

Returns a response from an Internet resource. Overrides the WebRequest .System.Net.WebRequest.GetResponse method.

Returns WebResponse — The response from the Internet resource.

GetRequestStream()

public override Stream GetRequestStream()

Submits a request with HTTP headers to the server, and returns a Stream object to use to write request data.

Returns Stream — A Stream to use to write request data.