单击后退按钮,避免重新提交表单 [英] Avoid form re-submission clicking on back button

查看:79
本文介绍了单击后退按钮,避免重新提交表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张表格。在提交按钮时,它会将记录插入到数据库中。如果我回到我的浏览器并刷新页面,它会重新提交它,导致各种各样的问题,你可以想象。我如何确保用户无法刷新上一页并且该页面的状态会像这样刷新另一个自动提交?



我是不使用ViewState。我实际上已在页面指令中禁用它

否,Response.Redirect无法解决此问题。用户仍然可以使用浏览器的后退按钮返回并在他们提交的位置刷新,它仍将运行按钮的事件,将数据下游发送到我的DL插入

解决方案

检查这些链接

避免页面刷新时按钮点击事件 [ ^ ]

http://www.dotnetspider.com/resources/4040-IsPageRefresh-ASP-NET.aspx [<一个href =http://www.dotnetspider.com/resources/4040-IsPageRefresh-ASP-NET.aspx\"target =_ blank title =新窗口> ^ ]


尝试这样做:



Post-Redirect-Get [ ^ ]



希望它帮助:)


简单的解决方案是控件的明确文本,并检查验证虽然事件将被解雇它将检查验证。

如果这个请告诉我有帮助的。

I have a form. On submit of a button, it inserts a record into the db. If I go back in my browser and refresh the page it''s resubmitting it causing all sorts of issues as you can imagine. How do I ensure that the user can''t refresh the previous page and the state of that page does another automatic submit on refresh like this?

I''m not using ViewState. I actually have it disabled in the page directive
No, Response.Redirect does NOT solve this problem. The user can still go back with the browser''s back button and refresh at the point where they submitted and it will still run the button''s event sending the data downstream to my DL insert

解决方案

Check thses links
Avoid button click event on page refresh[^]
http://www.dotnetspider.com/resources/4040-IsPageRefresh-ASP-NET.aspx[^]


Try doing with this:

Post-Redirect-Get[^]

hope it helps :)


Simple solution is clear text of controls and check for validation though event will get fired it wil check for validation.
Please let me know if this helpful.


这篇关于单击后退按钮,避免重新提交表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆