I have a web project (C #, MVC5 but not WebAPI) and a simple HTTP REST client that calls an external REST service and receives an accessToken link.
I want to check the response from all the Get / PostAsync calls for statusCode 401, but I see that when implementing the DelegatingHandler I can override the SendAsync method.
class CustomDelegatingHandler : DelegatingHandler { async protected override Task<HttpResponseMessage> SendAsync( HttpRequestMessage request, CancellationToken cancellationToken) { HttpResponseMessage response = await base.SendAsync(request, cancellationToken); if (response.StatusCode == HttpStatusCode.Unauthorized) {
Is there anything else I can do to not change the implementation of all my asynchronous calls to use SendAsync ?
(What I really want to do is update the accessToken.)
maria Mar 17 '15 at 18:10 2015-03-17 18:10
source share