asp.net中的浏览器后退按钮问题 [英] Browser Back Button Issue in asp.net

查看:60
本文介绍了asp.net中的浏览器后退按钮问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用一个简单的ASP.NET应用程序和回发后的后退按钮时遇到了麻烦.

有问题的页面上有一个简单的表单,一些文本字段等,以及一个执行回发(自动回发)的下拉菜单.

正常"流程是用户填写表单,并可能更改下拉列表.根据下拉值,页面内容可能会更改.

我遇到的问题是,在用户更改了下拉列表并且回发完成之后,用户单击了后退"按钮.他们看到来自IE的网页已过期"消息.

我设置了以下内容:

Response.Cache.SetExpires(DateTime.Now.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.Private);
但这似乎并没有解决问题.

实际的Cache-Control响应标头读取为:私有,无缓存:"Set-Cookie"

在经典的ASP应用程序中,只有私人"的Cache-Control响应标头,后退按钮在回发"后的行为与预期的一样.

无论如何,有什么强制ASP.NET将缓存控件明确设置为完全私有"的吗?还是其他任何导致后退按钮和回发一起正常工作的解决方案?

谢谢!

I''m having trouble with a simple ASP.NET application and the back button after a post back.

The page in question has a simple form on it, some text fields etc, and a dropdown that does a postback (autopostback).

The "normal" flow is the user fills out the form and perhaps changes the dropdown. Based on the dropdown value the page content might change.

The problem I''m having is that after the user has changed the dropdown and the postback has completed then the user clicks the back button. They see a "webpage has expired" message from IE.

I''ve set the following:

Response.Cache.SetExpires(DateTime.Now.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.Private);
But that doesn''t seem to have nailed the problem.

The actual Cache-Control response header reads as: private, no-cache:"Set-Cookie"

In a classic ASP application the with a Cache-Control response header of just "private" the back button behaves as expected after a "post back".

Is there anyway to force ASP.NET to set the cache-control explicitly to exactly "private"? Or any other solution that results in the back button and postbacks working well together?

Thanks!

推荐答案

这似乎是一个可怕的问题,您能发布整个代码吗?
This seems to be awful problem, Can you post your whole code?


这篇关于asp.net中的浏览器后退按钮问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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