1

When click on Back button most of the times it is posting the data again to the server side. What I am thinking is, when click on back button it should load the previous page as it is without post data again. But it is not the way it is behaving. So what I exactly need is the back button should display the previous page without resend the data to the server again. Please let me know if there are any header changes or configurations to do to prevent this.

Thanks Chamil

2 Answers2

0

Do something similar to this,

When button clicked set boolean sent = true
If boolean is false
Send data to server
Lemex
  • 3,772
  • 14
  • 53
  • 87
  • Thanks.Yes I can do this for the new pages.I have thousands of pages in our web app.So I am expecting to work with back button behavior since I do not have to do any modification for existing functionalities. – Chamil Thushantha Aug 03 '12 at 08:20
0

If you have a "Cache-Control: no-cache" (and/or no-store) header, then remove it. See: Why both no-cache and no-store should be used in HTTP response?. (I think Cache-Control: private should still be ok, if you want to use that).

Community
  • 1
  • 1
sourcejedi
  • 3,051
  • 2
  • 24
  • 42
  • I do not have it.This is working as expected in IE7 and older.My web page is taking more than 6 seconds to load because of the number of rows it has.If it is taking less than 5 seconds, the back button working as expected giving me the cached previous page.But if it is taking more than 5 sec, then if you click the back button it will resend the request to the current page.Can it be a bug in IE8? Because it is working on IE7, Chrome as well. – Chamil Thushantha Aug 03 '12 at 08:11
  • Internet explorer, buggy? Could be! I searched [IE8 back button cache] and found there's definitely *some* bugs related to caching. . I think caching was rewritten to be more aggressive for IE8, so there's surely room for new bugs to have slipped in. – sourcejedi Aug 08 '12 at 08:35