在浏览器中单击“后退"不会加载asp.net页 [英] Clicking Back in browser doesn't load the asp.net page

查看:93
本文介绍了在浏览器中单击“后退"不会加载asp.net页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我遇到了一个与浏览器中后退"按钮有关的问题.

1.当我在浏览器中单击返回"时,我希望到达前一页(应加载前一页),但不会加载.当我调试它时,我看不到页面重新加载本身. (这可能是缓存问题吗?)

I have an issue that relates to the ''Back'' button in the browser.

1. When I click ''Back'' in the browser, I expect to reach the previous page ( the previous page should be loaded) but it doesn''t get loaded. When I debug it, I don''t see the page reload itself. (could it be a cache issue?)

推荐答案

我认为最好的答案是:它取决于浏览器,尤其是在发布/回发之后.
以前的浏览器通常会弹出一个确认对话框,显示页面包含将要重新提交的POST数据",您可以继续(重新提交)或取消.由于ASP.NET WebForms中发生的所有事情都是FORM元素的一部分(ViewState,事件等),因此这将导致整个生命周期被重复.

当然,这不会给重复提交带来麻烦,因此许多站点不得不提出解决重复问题的解决方法,而如今大多数浏览器只是从缓存中获取页面.
I think the best answer is: It depends on the browser, especially after a post/postback.

Older browsers used to pop up a confirmation dialog to the effect of "the page contains POST data which will be resubmitted", and you could either proceed (resubmit) or cancel out. Since everything that happens in ASP.NET WebForms is part of the FORM element (ViewState, events, etc.), this would cause the entire lifecycle to be repeated.

Of course, this caused no end of trouble with duplicate submissions, so many sites had to come up with workarounds for the dupe problem, and today most browsers just fetch the page from cache instead.


谢谢您的解释,但是当用户单击返回"时,如何使浏览器重新发布页面?
我读到应该将Cache-Control标头设置为no-cache.
这东西行吗?
Thank you for the explanation but how do I make the browser post the page again when the user clicks ''Back''?
I read that I should set the Cache-Control header to no-cache.
Will this thing work?


这篇关于在浏览器中单击“后退"不会加载asp.net页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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