harishr
harishr

Reputation: 18065

Disable caching of Web API responses

I want to disable browser caching of all the Web API responses across all the clients. Even though I can use libraries like CacheOutput or CacheCow as suggested in Scott Hanselman's blog but my requirement is not that complex. I just want to disable caching of all the Web API responses and do not need any custom control over it.

Upvotes: 5

Views: 14648

Answers (1)

Stefan Ossendorf
Stefan Ossendorf

Reputation: 801

Just use the Cache-Control: no-cache header.
Implement it as delegating-Handler and make sure your header is applied (with MS Owin Implementation hook up on OnSendingHeaders(). I'm using it here OnSendingHeaders() Example).

Upvotes: 10

Related Questions