0

I am working on an Ecommerce website using ASP.NET MVC where I am implementing a new payment method, and in this payment method the user flow goes something like this

Checkout -> Payment Provider site -> Processing page -> Checkout page/ Order confirmation page

Now, if the payment fails and the user is redirected back to the checkout page after the processing page and the user clicks the back button, he is redirected back to the processing page. Is there some way that we can handle and stop the user to visit the processing page again if he clicks back button

Ipsit Gaur
  • 2,872
  • 1
  • 23
  • 38
  • As far as I understand the processing page is under your control and not under the payment provider one. Have you tried to check whether the referrer is the payment provider? – ddfra Sep 20 '21 at 12:22
  • When the user clicks back, the request does not go to the server and is directly served from the browser cache. So I cannot check the referer on the processing page – Ipsit Gaur Sep 20 '21 at 12:26
  • @IpsitGaur - "is directly served from browser cache" that would be the case if the server would send headers that allow the browser to cache this page. The server must not send those headers here, so the page will not be served from browser cache. – Christoph Lütjen Sep 20 '21 at 12:30
  • @ChristophLütjen I have set browser cache headers as per https://stackoverflow.com/questions/22443932/cache-control-no-store-must-revalidate-not-sent-to-client-browser-in-iis7-as, but still it is fetched from browser cache – Ipsit Gaur Sep 20 '21 at 12:45
  • If headers are your problem, then please post the headers as you can see them in your browsers network panel. But that would be a different question. – Christoph Lütjen Sep 20 '21 at 13:02
  • One common approach is to simply check the state ("is checkout in progress?") on the processing page and if not, show a message or redirect to home. This way you keep the logic on the processing page. All you need to do is reset your checkout state if processing fails. You might get better answers if you add some background. – Christoph Lütjen Sep 20 '21 at 13:07

0 Answers0