要让 ASP.NET 应用程序支持浏览器的“后退”按钮,必须具备哪些条件?

发布于 2024-10-07 07:24:53 字数 79 浏览 0 评论 0原文

是否有任何模式或类型的“最低要求列表”可以遵循,以确保 asp.NET 应用程序支持每个 aspx 页面的浏览器后退按钮?

谢谢

Is there any pattern or kind of "least requirements list" to follow for ensuring an asp.NET application to support BACK button of the browser for each aspx page?

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

涫野音 2024-10-14 07:24:53

一般来说,浏览器上的后退按钮会将您带到上一个发生的 HTML GET 或 POST。它通过页面范围的事务进行导航,因此动态完成的任何操作都不能以这种方式进行导航。此外,后退按钮不会倒回代码执行,因此如果您要根据会话变量或类似的东西确定某些内容,则也不会倒回。显然,它也不会回滚数据库事务。

一般来说,如果您想支持后退按钮,则需要确保将您需要在其中导航的所有内容与所述按钮除以某种 HTML 事务分开。

同样,如果您的页面显示依赖于从一篇文章到下一篇文章的服务器端控制,您将遇到问题。这是当您尝试导航回某些表单时看到某些表单提供“页面已过期”错误的原因之一。

In general, the back button on the browser will take you to the previous HTML GET or POST that occurred. It navigates by page-wide transactions, so anything done dynamically cannot be navigated that way. Also, the back button doesn't rewind code execution, so if you are determining something based off of a Session variable or something similar, that won't be rewound either. Obviously, it won't rewind database transactions either.

In general, if you want to support the back button, you'll need to make sure to divide everything you need to navigate between with said button is divided by an HTML transaction of some sort.

Again, you're going to run into issues if your page display is dependent on server-side control that changes from one post to the next. This is one reason you see some forms feed a 'Page has expired' error when you try to navigate back to them.

梦情居士 2024-10-14 07:24:53

不一定...这取决于您的应用程序流程。
有些事情会让支持后退按钮变得更加尴尬。

例如使用纯ajax来更改页面上的大部分内容,
看起来像一个“新”页面,但与后退按钮不兼容(尽管你可以捏造它)

另一个例子是多次回发到同一页面,因为这可能会使后退按钮看起来不起作用,并同时重新执行您的请求(以及数据库事务)从

根本上讲,这取决于您的应用程序要求。

Not really... It depends on your application flow.
There are things that make supporting the back button more awkward.

for example using pure ajax to change the majority of the content on the page,
will look like a 'new' page but wont be compatible with the back button (though you can fudge it)

another example is posting back to the same page more than once, as this can make it appear like the back button is not working, and at the same time re-doing your request (and therefore database transactions)

Fundamentally it depends on your application requirements.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文