Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, May 10, 2018 11:09 AM
Hi,
In my MVC 5 app I got the following error when I press the browser Back button after opening a form. How can I prevent this error. I want, when user press browser Back button they will get the Index page or previously opened page. I tried putting the following code in Global.asax page but didn't work.
protected void Application_BeginRequest()
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();
}
Error:
Confirm Form Resubmission
This webpage requires data that you entered earlier in order to be properly displayed. You can send this data again, but by doing so you will repeat any action this page previously performed.
- Press the reload button to resubmit the data needed to load the page.
ERR_CACHE_MISS
All replies (4)
Thursday, May 10, 2018 11:24 AM ✅Answered
This problem is commonly handled using the Post/Redirect/Get pattern.
https://en.wikipedia.org/wiki/Post/Redirect/Get
https://www.stevefenton.co.uk/2011/04/asp-net-mvc-post-redirect-get-pattern/
Wednesday, August 15, 2018 2:13 PM ✅Answered
Refer to below post and get methods to pass the data to keep the dynamic flow and static client side resubmission of data
https://www.theserverside.com/news/1365146/Redirect-After-Post
https://web.archive.org/web/20061029012755/http://adamv.com/dev/articles/getafterpost
https://wildtricks.com/chrome/err_cache_miss-error-chrome/
http://balusc.omnifaces.org/2007/03/post-redirect-get-pattern.html
Friday, May 11, 2018 4:57 AM
Hi mgebhard,
Thanks for your response. I probably use the same pattern, see below-
if (ModelState.IsValid)
{
db.Products.Add(products);
db.SaveChanges();
return RedirectToAction("Index");
}
Please note that, I get it intermittently but some other get always.
Thursday, May 24, 2018 6:55 AM
Hi,
The scenario is: if I open a form to create/edit or go to any other view and hit browser back button it generates the mentioned error. It doesn't always happen, it happens about 30-40% times.
Could anybody suggest any solution on the subject matter please?