Skip to main content

WebRequest Class

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

Makes a request to a Uniform Resource Identifier (URI). This is an abstract class.

public abstract class WebRequest : MarshalByRefObject, IDisposable

Constructors

WebRequest()

protected WebRequest()

Initializes a new instance of the System.Net.WebRequest class.

Properties

Method

public virtual string Method { get; set; }

When overridden in a descendant class, gets or sets the protocol method to use in this request.

RequestUri

public virtual Uri RequestUri { get; }

When overridden in a descendant class, gets the URI of the Internet resource associated with the request.

ConnectionGroupName

public virtual string ConnectionGroupName { get; set; }

When overridden in a descendant class, gets or sets the name of the connection group for the request.

Headers

public virtual WebHeaderCollection Headers { get; set; }

When overridden in a descendant class, gets or sets the collection of header name/value pairs associated with the request.

ContentLength

public virtual long ContentLength { get; set; }

When overridden in a descendant class, gets or sets the content length of the request data being sent.

ContentType

public virtual string ContentType { get; set; }

When overridden in a descendant class, gets or sets the content type of the request data being sent.

Timeout

public virtual int Timeout { get; set; }

Gets or sets the length of time, in milliseconds, before the request times out.

DefaultWebProxy

public static IWebProxy DefaultWebProxy { get; set; }

Gets or sets the global HTTP proxy. The DefaultWebProxy property determines the default proxy that all WebRequest instances use if the request supports proxies and no proxy is set explicitly using the Proxy property. Proxies are currently supported by HttpWebRequest.

Proxy

public virtual IWebProxy Proxy { get; set; }

When overridden in a descendant class, gets or sets the network proxy to use to access this Internet resource.

Methods

Dispose()

public void Dispose()

Releases buffered memory (the unmanaged firmware/application buffers). (inherited)

Dispose(bool disposing)

protected virtual void Dispose(bool disposing)

Closes a response stream, if present. (inherited)

ParameterTypeDescription
disposingboolNot used.

Abort()

public virtual void Abort()

When overridden in a descendant class, aborts the request.

GetRequestStream()

public virtual Stream GetRequestStream()

When overridden in a descendant class, returns a Stream for writing data to the Internet resource.

Returns Stream — A Stream for writing data to the Internet resource.

GetResponse()

public virtual WebResponse GetResponse()

When overridden in a descendant class, returns a response to an Internet request.

Returns WebResponse — A WebResponse containing the response to the Internet request.

Create(string requestUriString)

public static WebRequest Create(string requestUriString)

Initializes a new WebRequest instance for the specified URI scheme, such as http://, https://, or file://.

ParameterTypeDescription
requestUriStringstringThe URI that identifies the Internet resource.

Returns WebRequest

Create(Uri requestUri)

public static WebRequest Create(Uri requestUri)

Creates a WebRequest .

ParameterTypeDescription
requestUriUriA System.Uri containing the URI of the requested resource.

Returns WebRequest

RegisterPrefix(string prefix, IWebRequestCreate creator)

public static bool RegisterPrefix(string prefix, IWebRequestCreate creator)

Registers a WebRequest descendant for the specified URI.

ParameterTypeDescription
prefixstringThe complete URI or URI prefix that the WebRequest descendant services.
creatorIWebRequestCreateThe create method that the WebRequest calls to create the WebRequest descendant.

Returns bool — true .