I try to implement Response cache in asp.net core project but its not working.This is startup.cs
:
public void ConfigureServices(IServiceCollection services)
{
services.AddResponseCaching();
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseResponseCaching();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
And this is my controller.
[ResponseCache(Duration = 30)]
public IActionResult Index()
{
ViewBag.IsMobile = RequestExtensions.IsMobileBrowser(ContextAccessor.HttpContext.Request);
return View();
}
But still cache control header id
cache-control →no-cache, no-store
Where I am lacking please help. This response cache is not working and I take guidance from Microsoft document.