我SHOPING车应用程序我使用下面的代码,以保持Cart.There举行会议一个错误,当我打开我的网站在更多然后到浏览器有会议冲突,当我从我的一个浏览器,然后选择到另一个项目,所以先前创建的会话更新 ,但必须有每个浏览器的新会话 请有人帮助我了解会话中的错误的区域。我对着会话冲突错误在我的网站
#region Singleton Implementation
// Readonly properties can only be set in initialization or in a constructor
public static readonly ShoppingCart Instance;
// The static constructor is called as soon as the class is loaded into memory
static ShoppingCart()
{
// If the cart is not in the session, create one and put it there
// Otherwise, get it from the session
if (HttpContext.Current.Session["ShoppingCart"] == null)
{
Instance = new ShoppingCart();
Instance.Items = new List<CartItem>();
HttpContext.Current.Session.Add("ShoppingCart", Instance);
}
else
{
Instance = (ShoppingCart)HttpContext.Current.Session["ShoppingCart"];
}
}
// A protected constructor ensures that an object can't be created from outside
protected ShoppingCart() { }
#endregion
的声明谢谢亲爱的,但我得到了解决方案。 –