Reputation: 82
I have a web app running, but sometimes it fails when trying to go to another page, i think it might not even get to submit the changes in the db.
When the user saves the changes, it shows the typical "the webpage is not available", like the picture below:
The thing is that if i run the same URL, it works to me, but in the computer with the problem, i need to clear the cache before it allows me to go to the next page. I tried to check the connection, pinging the server, and in 25 packages i sent, only one crashed for timeout. Since the only solution i've found to fix the problem is to clear the cache, i want to know if there is a way to do it by code. I am programming in c#, MVC4. Another weird thing is that before i published some changes in the page, there is no problem in the other version, and i didn't make any important changes (that involved the core of the code).
Is there any other way to fix this problem?.
Thanks!
Upvotes: 1
Views: 9291
Reputation: 474
In your mvc controller you can add
[OutputCache(Location = OutputCacheLocation.None, NoStore = true)]
public ActionResult functionName(){ ... }
you can add on a method in your controller or in all controller
[OutputCache(Location = OutputCacheLocation.None, NoStore = true)]
public class SolicitudController
you can read about that in https://www.asp.net/mvc/overview/older-versions-1/controllers-and-routing/improving-performance-with-output-caching-cs
You can also try using javascript in your html Force browser to clear cache
I hope I help you!
Upvotes: 1