Implement HTTP Cache (ETag) in ASP.NET Core Web API

后端 未结 6 1540
悲&欢浪女
悲&欢浪女 2020-12-13 18:44

I am working on ASP.NET Core (ASP.NET 5) Web API application and have to implement HTTP Caching with the help of Entity Tags. Earlier I used CacheCow for the same but it see

6条回答
  •  余生分开走
    2020-12-13 19:10

    As an addendum to Erik Božič's answer I found that the HttpContext object was not reporting back the StatusCode correctly when inheriting from ActionFilterAttribute, and applied controller-wide. HttpContext.Response.StatusCode was always 200, indicating it was probably not set by this point in the pipeline. I was instead able to grab the StatusCode from ActionExecutedContext context.Result.StatusCode.

提交回复
热议问题