Udostępnij za pośrednictwem


HttpBaseProtocolFilter Class

Definition

The base protocol filter for an HttpClient instance.

public ref class HttpBaseProtocolFilter sealed : IClosable
public ref class HttpBaseProtocolFilter sealed : IClosable, IHttpFilter
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class HttpBaseProtocolFilter final : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class HttpBaseProtocolFilter final : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class HttpBaseProtocolFilter final : IClosable, IHttpFilter
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class HttpBaseProtocolFilter : System.IDisposable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class HttpBaseProtocolFilter : System.IDisposable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class HttpBaseProtocolFilter : System.IDisposable, IHttpFilter
function HttpBaseProtocolFilter()
Public NotInheritable Class HttpBaseProtocolFilter
Implements IDisposable
Public NotInheritable Class HttpBaseProtocolFilter
Implements IDisposable, IHttpFilter
Inheritance
Object Platform::Object IInspectable HttpBaseProtocolFilter
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

The HttpBaseProtocolFilter class provides the base filter or handler that is used by an HttpClient instance. If no additional filters are added to the HttpClient instance, then the HttpBaseProtocolFilter object will be the only filter.

The HttpBaseProtocolFilter class provides a set of properties for toggling various low-level HTTP stack behaviors.

Additional filters based on the IHttpFilter interface can be added to the filter chain applied to an HttpClient instance that can further handle or process the results from the HttpBaseProtocolFilter object.

The HttpBaseProtocolFilter object throws exceptions when sending HTTP requests or receiving response and network failures occur (loss of connectivity in airplane mode, for example). Developers using HttpClient in apps may prefer to add a filter to catch these exceptions and convert them to HTTP response codes instead.

Version history

Windows version SDK version Value added
1511 10586 CookieUsageBehavior
1607 14393 ClearAuthenticationCache
1607 14393 ServerCustomValidationRequested
1903 18362 CreateForUser
1903 18362 User

Constructors

HttpBaseProtocolFilter()

Initializes a new instance of the HttpBaseProtocolFilter class.

In a desktop app, before using an instance of this class in a way that displays UI, you'll need to associate the object with its owner's window handle. For more info, and code examples, see Display WinRT UI objects that depend on CoreWindow.

Properties

AllowAutoRedirect

Get or set a value that indicates whether the HttpBaseProtocolFilter should follow redirection responses.

AllowUI

Get or set a value that indicates whether the HttpBaseProtocolFilter can prompt for user credentials when requested by the server.

AutomaticDecompression

Gets or sets a value that indicates whether the HttpBaseProtocolFilter can automatically decompress the HTTP content response.

CacheControl

Get or set the read and write cache control behavior to be used on the HttpBaseProtocolFilter object.

ClientCertificate

Get or set the client SSL certificate that will be sent to the server if the server requests a client certificate.

CookieManager

Get the HttpCookieManager with the cookies associated with an app.

CookieUsageBehavior

Gets or sets the cookie usage behavior. By default, cookies are handled automatically.

IgnorableServerCertificateErrors

Get a vector of SSL server certificate errors that the app might subsequently choose to ignore.

MaxConnectionsPerServer

Get or set the maximum number of TCP connections allowed per HTTP server by the HttpBaseProtocolFilter object.

MaxVersion

Gets or sets the version of the HTTP protocol used.

ProxyCredential

Get or set the credentials to be used to negotiate with an HTTP proxy.

ServerCredential

Get or set the credentials to be used to authenticate with an HTTP server.

UseProxy

Get or set a value that indicates whether the HttpBaseProtocolFilter can use a proxy for sending HTTP requests.

User

Gets the User associated with the HttpBaseProtocolFilter.

Methods

ClearAuthenticationCache()

Clears authentication credentials currently cached on the device.

Close()

Closes the HttpBaseProtocolFilter instance and releases allocated resources.

CreateForUser(User)

Creates a new HttpBaseProtocolFilter for a specific User.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

SendRequestAsync(HttpRequestMessage)

Send an HTTP request using the HttpBaseProtocolFilter as an asynchronous operation.

Events

ServerCustomValidationRequested

This event is raised when the SSL/TLS connection is being established with the server. You should implement an event handler for this event if you need to perform extra validation (in addition to the OS default) of the server SSL certificate.

Applies to

See also