I'm using ASP.NET MVC Wrapper in MVC4 application.
Everything works fine besides one specific issue: I defined a datasource for Kendo UI Grid, and when the view loads, the read action is being called as expected.
However, when the page reloads, "read" request gets a response with 304 result.
How can I disable the cache through data source configuration?
You are able to set the 'cache' attribute in your Kendo dataSource to false, which apparently (NOTE: I have not tested this) will force the requested page(s) to be newly fetched on every request.
Setting cache to false appends a "_=[TIMESTAMP]" parameter to the request, which if necessary can be parsed on the server/controller side to avoid server-side cache operations.
Note too that you can specify cache behavior per Kendo transport operation (ie, it can be at the level of CRUD operations or for the whole transport).
See here: http://docs.kendoui.com/api/framework/datasource#configuration-transport.read.cache-Boolean
Code:
transport: {
read: {
cache: false
}
}
.Read(read => read
.Action("Action", "Controller", new { area = "Area" })
.Type(HttpVerbs.Post))
You can try decorating on server side controller's action that loads view with
[OutputCache(Duration = 0, NoStore = true)]
attribute, for instance
public class OrdersController : Controller
{
[httpGet]
[OutputCache(NoStore = true, Duration = 0)]
public ActionResult Orders(string userId)
{
// your code
return View(viewModel);
}
}
NoStore
- A Boolean value that determines whether to prevent secondary storage of sensitive information
Duration
- The time, in seconds, that the page or user control is cached. Setting this attribute on a page or user control establishes an expiration policy for HTTP responses from the object and will automatically cache the page or user control output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With