Click or drag to resize

ArcGISHttpClientHandlerHttpRequestBegin Event

Sets a global HTTP request listener invoked every time a request is made by the ArcGISHttpClientHandler.

Namespace:  Esri.ArcGISRuntime.Http
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.11.0
public static event EventHandler<HttpRequestMessage> HttpRequestBegin


Type: SystemEventHandlerHttpRequestMessage

You can use this to intercept any outgoing requests and for instance inject extra headers, append data to the query string etc, based on the request URL.

This listener is called on each and every request made by the ArcGIS Runtime, and therefore must be both thread-safe and highly performant.

Requests that implement ArcGISHttpRequestMessage provide the additional option of configuring or replacing the HttpMessageHandler that services that request.

Create a request listener that appends a header for requests to a specific domain.
ArcGISHttpClientHandler.HttpRequestBegin += (sender, request) =>
    if (request.RequestUri.Host == "")
        request.Headers.Add("X-CustomHeader", "My Custom Header");
See Also