刷新页面时如何禁止重新发布-ASP.NET MVC [英] How to supress re-post when refreshing a page - ASP.NET MVC

查看:61
本文介绍了刷新页面时如何禁止重新发布-ASP.NET MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用asp.net mvc构建向导.当前,当用户单击下一个(或上一个)时,表单值将发布到一个动作,该动作将进行所需的任何处理,然后呈现下一个视图.

I am building a wizard using asp.net mvc. currently when the user hits next (or previous) the form values are posted to an action which does any processing required and then renders the next view.

我遇到的问题是,如果用户在该新视图中单击刷新",则会提示他们重新发布表单值,这会导致大量问题.

the problem i am having is that if the users hit refresh in that new view they get prompted to re-post the form values which causes a ton of problems.

在firefox中,我收到消息:要显示此页面,应用程序必须发送将重复之前执行的任何操作(例如搜索或订单确认)的信息."

In firefox i am getting the message: "To display this page, the application must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."

有什么方法可以防止用户重新发布到操作中吗?

Is there any way to prevent users from being able to re-post back to the action?

谢谢.

推荐答案

使用PRG模式.

http://en.wikipedia.org/wiki/Post/Redirect/Get

这篇关于刷新页面时如何禁止重新发布-ASP.NET MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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