16

I Have an module in one application that loads the list of items in dropdown depending if these items are set true of checked in system settings.

When certain item is set to yes, this item should automatically be part of the dropdown choices. This PERFECTLY WORKS in Google Chrome and other browsers but NOT in Internet Explorer.

I thought of cache problem since i experience the same in previous projects.

i just include this above the action in controller

[OutputCache(NoStore = true)]

Tried the same now in ASP.Net Core MVC

But having a "namespace "OutputCacheAttribute" could not be found.

  1. is this no longer part in core mvc?
  2. tried responseCache which is available, but does not work also, is responsecache the alternative incore mvc? what's the difference?
rickyProgrammer
  • 1,177
  • 4
  • 27
  • 63
  • 2
    Possible duplicate of [How do I apply the OutputCache attribute on a method in a vNext project?](https://stackoverflow.com/questions/27304210/how-do-i-apply-the-outputcache-attribute-on-a-method-in-a-vnext-project) – jamesSampica Aug 24 '17 at 04:13

1 Answers1

19

You can use

[ResponseCache(VaryByHeader = "User-Agent", Duration = 30)]
public IActionResult About2()
{
    return Ok();
}

MSDN link

Calabonga
  • 310
  • 3
  • 11
  • 7
    There is also option `services.AddResponseCaching();` and `app.UseResponseCaching();` in `startup.cs` i guess it has to be enabled. – Muflix Feb 08 '19 at 11:49