我在ASP Classic中有一个包含表单的页面,当用户提交表单时,他按下IE8的后退按钮并再次填写表单,他重复使用了之前输入的几乎所有数据。
我们刚刚在网站上实现了SSL,现在当用户点击IE8的后退按钮时,表单的字段将被重置。我在Chrome中测试它并保持表单状态,但IE8没有。
如何在按下后退按钮时强制IE8不清除表单内容?
这是来自IE8的响应头:
Key Value
Response HTTP/1.1 200 OK
Date Tue, 25 Nov 2014 03:04:49 GMT
Server Microsoft-IIS/6.0
X-Powered-By ASP.NET
pragma no-cache
cache-control private
Content-Type text/html
Expires Sat, 15 May 1999 04:00:00 GMT
Cache-control private
Transfer-Encoding chunked
Set-Cookie asdfommited; Expires=Tue, 25-Nov-2014 04:04:15 GMT; Path=/
Set-Cookie asdfommited; Expires=Tue, 25-Nov-2014 04:04:15 GMT; Path=/
这是Chrome的响应标题:
Request Headers:
Provisional headers are shown
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Referer:https://www.ommited.com
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36
Resonse Headers:
cache-control:private, private
Content-Encoding:gzip
Content-Type:text/html
Date:Tue, 25 Nov 2014 02:57:49 GMT
Expires:Sat, 15 May 1999 04:00:00 GMT
pragma:no-cache
Server:Microsoft-IIS/6.0
Vary:Accept-encoding
X-Powered-By:ASP.NET
答案 0 :(得分:0)
我找到了造成这个问题的原因。 ASP页面中有以下说明,它们强制页面不使用缓存。我刚刚删除了那些行,现在当按下退格键时,它显示的是先前在表单中输入的值。
Response.Expires=15;
Response.ExpiresAbsolute = 'May 15, 1999';
Response.AddHeader ("pragma", "no-cache");
Response.AddHeader ("cache-control", "private");
Response.CacheControl = "private";