重新提交后如何限制之前的操作。例如,如果我单击一个按钮,如果我重新提交(f5)该页面将刷新,那么我们之前单击的按钮将再次执行。所以我不想再执行一次。那么你能帮我解决这个问题吗?
最佳答案
您应该阅读有关PRG 模式的内容:
Post/Redirect/Get (PRG) is a web development design pattern that prevents some duplicate form submissions, creating a more intuitive interface for user agents (users). PRG implements bookmarks and the refresh button in a predictable way that does not create duplicate form submissions.
更多关于此here .
其工作方式的简短说明:
When a web form is submitted to a server through an HTTP POST request, a web user that attempts to refresh the server response in certain user agents can cause the contents of the original HTTP POST request to be resubmitted, possibly causing undesired results, such as a duplicate web purchase. To avoid this problem, many web developers use the PRG pattern1 — instead of returning a web page directly, the POST operation returns a redirection command.
关于c# - C# 中的重新提交限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21431550/