开发者

Session Variable not working in Internet Explorer, but works fine in Firefox / Chrome

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

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

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);

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.

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

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


It appears as though you are using ajax somewhere.

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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜