日期:2014-05-18  浏览次数:20406 次

各位防刷新,防二次提交有什么高招每没?
RT

------解决方案--------------------
使用ViewState 提交后如果ViewState为空将ViewState赋值,不为空则认为是二次提交
------解决方案--------------------
按钮提交过后,visibile=false
------解决方案--------------------
ViewState 就是本页使用的
------解决方案--------------------
完成操作后,加个Response.Redirect重新定向回本页
------解决方案--------------------
清空viewstate跳到另一个页面再转回去呗
------解决方案--------------------
http://www.cnblogs.com/fengzhimei/archive/2004/08/03/29642.aspx
http://www.codeproject.com/aspnet/SyncControl.asp
------解决方案--------------------
加个验证码
------解决方案--------------------
protected void Button1_Click(object sender, EventArgs e)
{
if ( ViewState[ "Submit "] != null )
{
LWord txtcontext = new LWord();
txtcontext.TextContent = this.TextArea1.Value;
(new Services()).send_word(txtcontext);
this.TextArea1.Value = " ";
Binder();
ViewState[ "Submit "] = "1 ";
}
}
------解决方案--------------------
mark下
------解决方案--------------------
如果是按钮触发事件,做一个Response.Write( " <script language= 'javascript '> alert( '操作成功 ');history.go(-1); </script> ");
要不就Response.Redirect
这是最简单的两个方法.
如果你觉得不够好,建议采取楼上说的加验证码,或者做viewstate处理