Shared, configured HttpClient infrastructure used to replace the obsolete HttpWebRequest/WebRequest API.
HttpClientFactory
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| Reset | 1 | Reset the cached HttpClient (e.g. |
| SetProxy | 1 | Configure the proxy used by the shared HttpClient. |
| GetStringSync | 1 | Perform a synchronous GET and return the response body as text. |
| GetStreamSync | 1 | Perform a synchronous GET and return the response stream. |
| SendSync | 2 | |
| PostBytesSync | 1 | Synchronous POST of raw bytes with an explicit content-type. |
| PostFormSync | 1 | Synchronous POST of form-urlencoded name/value pairs. |
03 Properties
04 Members
Reset the cached HttpClient (e.g. after changing HttpClientFactory.Proxy or HttpClientFactory.UserAgent).
String)Configure the proxy used by the shared HttpClient. An empty/null value clears the proxy (system default is used).
String)Perform a synchronous GET and return the response body as text.
String)Perform a synchronous GET and return the response stream. The caller is responsible for disposing the returned stream (it is a copy of the network stream that can be read fully).
HttpRequestMessage)Send an arbitrary HttpRequestMessage synchronously.
Synchronous POST of raw bytes with an explicit content-type.
String, NameValueCollection)Synchronous POST of form-urlencoded name/value pairs.
Configurable proxy. When Nothing the system default proxy is used (mirrors the previous behaviour).
Default user-agent header sent with every request.
A shared HttpClient instance configured to behave like the previous HttpWebRequest based pipeline.
HttpRequestMessage, TimeSpan)