Reputation: 154
I created a page that shows a user a receipt that says they have successfully completed a payment from a third party site. I am trying to prevent the user from going back to the third party's page and making a duplicate payment. I was thinking I could logout the user when they hit the back button so that it would kick them off the site and onto the login page.
I tried using:
protected void Page_Unload(object sender, EventArgs e)
{
Response.Redirect("Login.aspx");
}
but I get the error: "System.Web.HttpException: Response is not available in this context"
The flow of the site is: login on Login.aspx then fill out an application on the next page. After completion of application the submit button takes the user to a page where they select defer payment or pay with card. If they pay with card they are taken to the third party site and fill out their information. The third party site then sends them back to receipt page that I created.
So the question is: how would I go about logging someone out upon hitting the back button?
Upvotes: 0
Views: 211
Reputation: 62260
We do not normally see a shopping cart logs out a user after completed. If you do so, user will get mad.
In addition, you cannot control the back button. Instead, you can create like this steps -
Cart Page -> Go to third party site -> Confirmation Page -> Complete Page.
If user completed the check out at completed page
and click back button, you can still validate the cart at confirmation page
.
For example, saving a SessionState
from cart page all the way to completed page
. Clear the session state if cart is completed successfully. If user browsers Confirmation Page
without SessionState
, then display Your cart is empty
.
Upvotes: 1