ASP.NET - 谷歌浏览器的缓存DropDownList的选择 [英] ASP.NET - Google Chrome caching DropDownList selections

查看:164
本文介绍了ASP.NET - 谷歌浏览器的缓存DropDownList的选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了似乎是我的购物车页面上的缓存问题与谷歌Chrome和Safari。在车有2个下拉列表。当您在下拉列表中更改值后击中结帐按钮,它犯什么在列表中选择该数据库。

I'm experiencing what seems to be a caching issue with Google Chrome and Safari on my cart page. In the cart there are 2 dropdown lists. When you hit the checkout button after changing the values in the dropdown lists, it commits what's selected in the lists to the database.

这是一个有点难以解释的异常行为,所以我会尽量写出来一步一步与我的问题的说明。

It's a little bit hard to explain the unexpected behavior so I will try to write it out step by step with an illustration of my problem.

让我们说第一个下拉列表包含的值:

Lets say the first dropdown list has the values of:


  • VALUE1

  • VALUE2

  • VALUE3

和第二个下拉列表中具有的值:

And the second dropdown list has the values of:


  • DUMBO1

  • DUMBO2

  • DUMBO3

我添加项目到我的车。

屏幕说:VALUE1,DUMBO1

Screen Says: VALUE1, DUMBO1

数据库云:VALUE1,DUMBO1

Database Says: VALUE1, DUMBO1

我打结帐。

数据库说:VALUE1,DUMBO1(我无法看到下拉列表中我打结账后,因为我的购物车页面可不是)

Database says: VALUE1, DUMBO1 (I can't see the dropdown lists after I hit checkout because i'm not at the cart page)

我打的后退按钮。

屏幕说:VALUE1,DUMBO1

Screen Says: VALUE1, DUMBO1

数据库云:VALUE1,DUMBO1

Database Says: VALUE1, DUMBO1

我下拉VALUE1组合和选择VALUE2,VALUE2瞬间选中,然后现场回发,并在下拉列表VALUE1重新选择(从数据库被重新加载)

I drop down the VALUE1 combo and select VALUE2, VALUE2 is selected momentarily and then the site posts back and VALUE1 is re-selected in the drop down list (from being reloaded from the DB)

短暂屏幕说:VALUE2,DUMBO1

MOMENTARILY Screen Says: VALUE2, DUMBO1

数据库云:VALUE1,DUMBO1

Database Says: VALUE1, DUMBO1

再经过回发FROM DROPDOWNLIST_SELECTIONCHANGED EVENT

THEN AFTER POSTBACK FROM DROPDOWNLIST_SELECTIONCHANGED EVENT

屏幕说:VALUE1,DUMBO1

Screen Says: VALUE1, DUMBO1

数据库云:VALUE1,DUMBO1

Database Says: VALUE1, DUMBO1

点击结帐。

数据库VALUE1说,DUMBO1(我无法看到下拉列表中我打结账后,因为我的购物车页面可不是)

Database Says VALUE1 ,DUMBO1 (I can't see the dropdown lists after I hit checkout because i'm not at the cart page)

返回。

屏幕说: VALUE2 的,DUMBO1

Screen Says: VALUE2, DUMBO1

数据库云:VALUE1,DUMBO1

Database Says: VALUE1, DUMBO1

这样看来,它的记忆我VALUE2选择,即使它跳了回VALUE1之前我检查了。

So it appears that it's remembering my selection of VALUE2 even though it jumped back to VALUE1 before I checked out.

这似乎是一个缓存的问题,但是我有一些无缓存code到该页面,在Firefox和Internet Explorer的伟大工程,但似乎的prevent缓存在Chrome和Safari中失败。我基本上返回的标头的购物车页:无缓存,无存储和必重新验证尝试prevent缓存,但基于这种情况下它似乎是缓存页面反正不重装它,当我打的后退按钮。

It seems to be a caching problem, however I've got some no-cache code to prevent caching of that page that works great in firefox and internet explorer but seems to be failing in Chrome and Safari. I'm basically returning in the headers for the cart page: no-cache, no-store, and must-revalidate to attempt to prevent caching, but based on this scenario it seems to be caching the page anyway and not reloading it when I hit the back button.

我愿意在这一点上的任何解决方案或建议。谢谢!

I am open to any solutions or suggestions at this point. Thanks!

推荐答案

我有一个类似的问题,我已经花了好几天的测试才发现没有答案。

I had a similar problem and I have spent several days testing only to find no answer.

假设我们有充满色彩一个DropDownList。每次我改变数值时我让阿贾克斯部分回发来保存价值,做一对夫妇如检查股票更多的事情。

Suppose we have a dropdownlist filled with colors. each time I change the value I make a partial postback with ajax to save the value and do a couple more things like checking stocks.

我选择(以这个顺序):红,白,蓝,绿

I choose (in this order): red, white, blue, green.

然后我打结账,当我回到我惊喜的是选择了红色。我再回去,我得到的白色选择。然后蓝回去四次后,终于绿色。

then I hit checkout and when I go back to my surprise the red color is selected. I go back again and I get white selected. then blue and finally green after going back four times.

我试着在IE和FF,发现那里工作得很好,所以它不是在code的错误。它必须是一些与镶边。

I tried at IE and FF and found there it works fine so it's not a bug in the code. it has to be something with the chrome.

任何人都可以在这方面帮助?

anybody can help with this?

编辑:我试着用另一个网页我做有它工作正常,但我不能找到它们之间的差异,可能会导致它

edit: I tried with another webpage I'm making and there it works fine but I can't find any differences between them that could cause it.

EDIT2:我找到了一种方法来解决它 ScriptManager.RegisterStartupScript 在导航事件编写一个脚本,设置值正确而不是在 codebehind 这样做。这不是一个非常优雅的方式,但它为我工作,我希望其他人有类似的问题。

I found a way to "solve" it using ScriptManager.RegisterStartupScript at the navigate event to write a script that sets the values correctly instead of doing it at codebehind. It's not a very elegant way but it worked for me and I hope for others with a similar problem.

这篇关于ASP.NET - 谷歌浏览器的缓存DropDownList的选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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