gpt4 book ai didi

javascript - 限制用户付款完成后返回

转载 作者:行者123 更新时间:2023-11-28 08:59:18 24 4
gpt4 key购买 nike

I have integrated Payment Gateway in my Web Application made in MVC4 Razor. After payment has been done successfully the user is redirected to the return URL..

Then i do some process like generating unique id ,sending payment details sms blah blah..

[NoCache]
public ActionResult IPGResponse()
{
//Send SMS..
//Save Payment Response..etc

return RedirectToAction("ThankyouUploadDocument");
}

Then I redirect to another Action.

public ActionResult ThankyouUploadDocument()
{
//Do Something

return View("ThankyouUploadDocument" , paymentViewModel);
}

The problem is when user hit back .It goes to IPGResponse() and do all steps again .

I have also used [NoCache]..but it did not worked

I have to Restrict the user to go back to the IPGResponse() or Payment Gateway again..

最佳答案

这应该可以防止缓存:

        HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
HttpContext.Response.Cache.SetValidUntilExpires(false);
HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Response.Cache.SetNoStore();

也许一个好主意是在提交表单时进行服务器检查并返回错误,以防某些黑魔法缓存起作用。这确实不应该。

编辑:这将阻止浏览器的“后退”按钮加载缓存的页面,这就是问题所在。当然,您需要检查页面输入以查看交易是否已经发生。

关于javascript - 限制用户付款完成后返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17966761/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com