public override Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(_sasToken)) { Action <string> action = (value) => { #if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER _sasToken = value.Replace(SASHeaderName + " ", "", StringComparison.Ordinal); #else _sasToken = value.Replace(SASHeaderName + " ", ""); #endif SetAuthorizationHeader(request, _sasToken); }; #if NET5_0_OR_GREATER HttpRequestOptions requestOptions = request.Options; var requestOptionsKey = new HttpRequestOptionsKey <Action <string> >(TpmDelegatingHandler.ProvisioningHeaderName); requestOptions.Set(requestOptionsKey, action); #else request.Properties.Add(TpmDelegatingHandler.ProvisioningHeaderName, action); #endif } else { SetAuthorizationHeader(request, _sasToken); } return(base.ProcessHttpRequestAsync(request, cancellationToken)); }