I have an ASP.NET MVC 5 application. This application requests records through WEB API web service. WEB API calls back to a exctetion method that returns results in JSON format. I have not been able to prove this, but I'm concerned that my data may be getting cached.
I only want the caching to be applied to specific actions, not for all actions.
Is there an attribute that I can put on an action to ensure that the data does not get cached? If not, how do I ensure that the browser gets a new set of records each time, instead of a cached set?
I put the below attributes on action to ensure that the data do not get cached.But do not work correctly after insert data. So after reset IIS effected the changes.
[System.Web.Mvc.OutputCacheAttribute(VaryByParam = "*", Duration = 0, NoStore = true)]
public class UserController : ApiController
{
[HttpPost]
[NoCache]
public List<DataModel> Get()
{
var result= ExtMethod.GetData();
return result;
}
}