NSUrlSessionHandler Class

Definition

The default message handler used by HttpClient on Apple platforms using the Xamarin stack (iOS, macOS, watchOS, tvOS)

public ref class NSUrlSessionHandler : System::Net::Http::HttpMessageHandler
public class NSUrlSessionHandler : System.Net.Http.HttpMessageHandler
type NSUrlSessionHandler = class
    inherit HttpMessageHandler
Public Class NSUrlSessionHandler
Inherits HttpMessageHandler
Inheritance
NSUrlSessionHandler

Remarks

The NSUrlSessionHandler is an HTTP client handler that delegates its work to Apple’s built-in NSUrlSession.   This is the default when you compile your application, but you can opt-out of it manually in your application by selecting a different handler.

Using the Apple NSUrlSession has some advantages over using any socket-based implementation, the chief one being that on a mobile device, it will automatically turn on the radio on your behalf and you will avoid a potential timeout or an error if the radio is down.

Additionally, you can configure the handler to continue your downloads even if your application is suspended or has stopped running.

Constructors

NSUrlSessionHandler()

The default constructor for NSUrlSessionHandler configures the handler with a NSUrlSessionConfiguration set to the default value, and customizes the resources time out to be 24 hours (as infinite timeouts are not supported by Apple’s own transport).

Properties

AllowAutoRedirect

Gets or sets a value that allows automatic redirection. Its default value is true.

Credentials

Gets or sets authentication information used by this handler.

DisableCaching

Methods

Dispose()

Releases the unmanaged resources and disposes of the managed resources used by the HttpMessageHandler.

(Inherited from HttpMessageHandler)
Dispose(Boolean)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Send(HttpRequestMessage, CancellationToken)

When overridden in a derived class, sends an HTTP request with the specified request and cancellation token. Otherwise, throws a NotSupportedException.

(Inherited from HttpMessageHandler)
SendAsync(HttpRequestMessage, CancellationToken)

Sends an HTTP request as an asynchronous operation.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to