Navigation

MVC Caching: How to Disable Automatic Caching in ASP.Net MVC

disable cache in mvc, remove cache mvc C#, mvc turn off caching, caching in mvc c#, caching in mvc 5, remove cache mvc

Introduction

Today, I am explaining very important part of MVC application, just explaining about how to disable automatic caching in ASP.Net MVC application. It is very important in our MVC app while we don't allow end user to navigate browser cache (next, previous button etc.). MVC has provided feature to disable caching in ASP.Net MVC application.

Click to go back, hold to see history

Here you can see Chrome browser previous button is allowing to click to go back, hold to see history, now I clicked on this specific previous navigation button.

Click to go back, hold to see history

Now, you will see results as below that it requires from us to Confirm Form Resubmission


Confirm Form Resubmission

Disable Automatic Caching Code Snippet

[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public ActionResult Start_My_Test() 
{
   // do something here
   return View();
}

Summary

Above, I have explained in full depth how we can disable automatic caching in ASP.Net MVC application. So it plays very vital role to make our application robust, secure and real time.

Relevant Reading

Share

Anjan Kant

Outstanding journey in Microsoft Technologies (ASP.Net, C#, SQL Programming, WPF, Silverlight, WCF etc.), client side technologies AngularJS, KnockoutJS, Javascript, Ajax Calls, Json and Hybrid apps etc. I love to devote free time in writing, blogging, social networking and adventurous life

Post A Comment:

0 comments: