Ich habe den folgenden Code, der Sitzung verwendet, aber ich habe einen Fehler in der Zeile :
if (Session["ShoppingCart"] == null)
der Fehler ist cS0103: The name 'Session' does not exist in the current context
Was ist das Problem?
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Web.SessionState;
/// <summary>
/// Summary description for ShoppingCart
/// </summary>
public class ShoppingCart
{
List<CartItem> list;
public ShoppingCart()
{
if (Session["ShoppingCart"] == null)
list = new List<CartItem>();
else
list = (List<CartItem>)Session["ShoppingCart"];
}
}