Redirect to prevent dup submission...but then you loose existing data
Posted
by coffeeaddict
on Stack Overflow
See other posts from Stack Overflow
or by coffeeaddict
Published on 2010-04-30T20:29:43Z
Indexed on
2010/04/30
20:37 UTC
Read the original article
Hit count: 192
ASP.NET
Here's the scenario
- User is on your checkout.aspx page
- Somewhere in the process, when clicking the pay button, you redirect the user to an intermediate page (before the confirmation page) to do some other logic.
- That intermediate page performs whatever logic based on a querystring flag you sent with the redirect from the checkout page
- This intermediate page also serves as an error page. So if any logic in the intermediatePage.aspx.cs fails I'm setting a message to be displayed on this page to the user
- If I refresh, that querystring value is still in the url..hence when it hits my Page_Load again, then the server-side logic is called & run again and I don't want this to happen
- The avoid this behavior/problem, the logical next step is to do a redirect back to the same page if they refresh (not sure how you'd catch that) to get rid of that querystring
- But when you redirect back to the same page your error message is gone, lost in the redirect therefore you end up showing them the same page but all values for the error message are now gone
I do not want to solve this with Javascript either.
I am not sure the best way to handle this.
© Stack Overflow or respective owner