I have a web application in vb net MVC and I am having a problem. My page displays the stock of an article with an url: Stock? Id = ART01
When I go to my page once, the method is called in the controller (I put a breakpoint) If I refresh the page, the method is not called in the controller why?
I tried to add this thinking it was a cache issue:
<AttributeUsage((AttributeTargets.Class Or AttributeTargets.Method))> _
Public NotInheritable Class NoCacheAttribute
Inherits ActionFilterAttribute
Public Overrides Sub OnResultExecuting(ByVal filterContext As ResultExecutingContext)
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1))
filterContext.HttpContext.Response.Cache.SetValidUntilExpires(False)
filterContext.HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches)
filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache)
filterContext.HttpContext.Response.Cache.SetNoStore()
MyBase.OnResultExecuting(filterContext)
End Sub
End Class
<NoCacheAttribute>
Public Class MyController
Inherits Controller
But it doesn't work.
Do you have an idea ?