是否页面重载曾经引起帖子? [英] Does page reload ever cause post?

查看:174
本文介绍了是否页面重载曾经引起帖子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速的问题,我已经尝试弄清这一点我自己,而是想弄清楚为什么或如何一个页面重新加载,做/没有做它应该做的时候使用Session变量可能会造成混淆。

Quick question, I have tried figuring this out myself, but the use of Session Variables can be confusing when trying to figure out why or how a page is reloading and doing/not doing what it is supposed to do.

是否重新加载页面(使用JavaScript,F5,Ctrl + F5,浏览器的刷新按钮等)以往,在任何(非脚本)的情况引起的形式重新发布?

Does a page reload (with JavaScript, f5, ctrl+f5, browser reload button, etc) ever, under any (non-scripted) circumstance cause a form repost?

(这涉及到使用C#code类的例子code以下内IfPost分支):

(This pertains to using IfPost branches within C# code like the example code below):

if(IsPost)
{
    //stuff that only executes if the previous request was a post.
}

我只是那种需要知道在这里会发生什么,所以我可以正确诊断我的会话状态的问题。

I just kind of need to know what to expect here so I can properly diagnose my session state problems.

感谢您的帮助!

(同样,对不起,如果我是过于简单化了这个问题。我知道这'可能'会复杂得多,一个简单的答案可以提供)。

(Also, sorry if I am oversimplifying this question. I realize that it 'may' be more complicated than a simple answer can provide).

******UPDATE**********
另外,我看了这个问题的副本在这里,在计算器上,但我没有看到任何东西,因此,如果这是一个重复的问题,我很抱歉。

******UPDATE********** Also, I looked for copies of this question here, on StackOverflow, but I didn't see anything, so if this is a duplicate question, I apologize.

无论这里的答案都是很好的答案。我承认,也提供了一个解决我的问题的答案,虽然PRG是不是唯一的方式做到这一点,就好像它可能是最好的。它也似乎越来越多的方法来处理客户端的用户友好性,恕我直言,似乎将是一个伟大的习惯进入。

Both of the answers here are good answers. I accepted the answer that also offered a solution to my question, and while PRG is not the 'only' way to do it, it seems like it may be the best. It also seems a growing way to handle client-side user-friendliness, and imho, seems like it would be a great habit to get into.

谢谢显示我!

推荐答案

是的。如果页面使用POST数据加载,这将发生。以prevent这一点,你需要实现 POST /重定向/ GET 模式

Yes. If the page was loaded using POST data this will occur. To prevent this you need to implement the POST/REDIRECT/GET pattern.

邮政/重定向/获取(PRG)是一个Web开发设计模式prevents一些重复的表单提交,从而为用户代理(用户)更直观的界面。 PRG支持在不创建重复的表单提交一个predictable方式书签和刷新按钮。

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 supports bookmarks and the refresh button in a predictable way that does not create duplicate form submissions.

这篇关于是否页面重载曾经引起帖子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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