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
Syntax
public static event EventHandler<HttpRequestMessage> HttpRequestBegin

Value

Type: SystemEventHandlerHttpRequestMessage
Remarks

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.

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