-
Notifications
You must be signed in to change notification settings - Fork 7
Kevin Dockx edited this page Jan 20, 2015
·
6 revisions
To temporarily override the cache for a request (ie to explicitly ask for an uncached response), you should create a request and change the CacheControl header for that request. If you state that NoCache is true, the no-cache header will be added to the request, and the request will get through to the API and not go for possible cached responses in the cache store.
For example:
HttpRequestMessage request = new HttpRequestMessage();
request.Headers.CacheControl = new CacheControlHeaderValue()
{
NoCache = true
};
request.Method = HttpMethod.Get;
request.RequestUri = new Uri("youruritoyourresource", UriKind.Relative);
HttpResponseMessage response = await client.SendAsync(request);