在浏览器中刷新页面会产生POST或GET请求? [英] Refreshing a page in a browser yields POST or GET request?
问题描述
我正在学习asp.net mvc表单处理,并与以下内容混淆:
I am learning asp.net mvc form processing now and confused with the following:
如果按下浏览器上的刷新按钮会发生什么? 它发出POST或GET请求?
What happens if we push the refresh button on the browser? It makes a POST or GET request?
推荐答案
这取决于浏览器为获取当前数据而进行的最后一次调用.例如:
This is dependant on the last call that was made by the browser to get the current data. Eg:
a)如果您提交了表单,执行POST,然后单击刷新",则浏览器将执行另一个POST.
a) If you submitted a form, performing a POST and then hit refresh, the browser will do another POST.
b)如果您仅单击了将您带到另一个页面的链接,则执行GET,您将进行刷新将执行get.
b) If you just clicked a link that took you to another page, performing a GET, you'll a refresh will perform a get.
如果您刚开始了解GET/POST方法,那么您应该了解一个不错的模式,该模式将帮助您避免在用户反复刷新数据后不断刷新浏览器的情况下遇到这种情况.开机自检:
If you're just starting out understanding the GET/POST methods, there is a nice pattern that you should understand that will help you not get in situations where data is posted again and again by users who constantly refresh the browser after a POST:
http://en.wikipedia.org/wiki/Post/Redirect/Get
和
这篇关于在浏览器中刷新页面会产生POST或GET请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!