会话变量在Internet Explorer中无法正常工作,但在Firefox / Chrome的罚款 [英] Session Variable not working in Internet Explorer, but works fine in Firefox / Chrome

查看:121
本文介绍了会话变量在Internet Explorer中无法正常工作,但在Firefox / Chrome的罚款的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经开发了Asp.Net MVC 3 web应用程序使用剃刀页。

We've developed a web app with Asp.Net MVC 3 using Razor pages.

在页面中,我们遇到了问题,用户选择从菜单项和它们添加到的详细信息页面,在相同类型的多个项目例如总计起来的右窗格中的顺序3×大蒜面包等。

In the page we're having problems with a user selects items from a menu and they're added to the order details pane on the right of the page, where multiple items of the same type are totaled up e.g. 3 x Garlic Bread etc.

要做到这一点,我们在一个会话变量添加到T的列表并将其存储在下面code:

To do this we add to a list of T and store it in a session variable as in the following code:

List<MunuItems> OrderItems = HttpContext.Session["_OrderItems"] as List<MunuItems>;

MunuItems newItem = new MunuItems();
// Set the newItem values

OrderItems.Add(newItem);
// Add the list to the session
HttpContext.Session.Add("_OrderItems", OrderItems);
// Retrun the partial view
return PartialView("_OrderItems", OrderItems);

本都在Firefox或Chrome工作正常,但是当我尝试这在Internet Explorer 8/9的行为是所有的地方。只有1可以添加每个项目,尝试添加第二项可造成其他物品落列表等

This all works fine in Firefox or Chrome, but when I try this in Internet Explorer 8 / 9 the behavior is all over the place. Only 1 of each item can be added, trying to add 2nd items can cause other items to drop off the list etc.

您可以查看这里的网页。 http://software.ayslive.com/WR_TakeAway/menu

You can view the page here http://software.ayslive.com/WR_TakeAway/menu

任何人都可以提出如何可以固定在Internet Explorer或为什么它不工作在IE?

Can anyone suggest how this can be fixed in Internet Explorer or why it's not working in IE?

推荐答案

看来好像你正在使用AJAX的地方。

It appears as though you are using ajax somewhere.

这很可能是你使用的是'GET'方法,它被缓存。如果是这样的尝试缓存:在你的Ajax调用虚假(默认值是true)

It is quite possible that you are using the 'GET' method and that it is cached. If so try cache: false in your ajax call (the default is true).

这篇关于会话变量在Internet Explorer中无法正常工作,但在Firefox / Chrome的罚款的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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