using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class _Default : System.Web.UI.Page { protectedvoid Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { Session["name"] ="1"; Session["name1"] ="2"; Session["name2"] ="3"; } } protectedvoid Button1_Click(object sender, EventArgs e) { string[] a =newstring[Session.Keys.Count]; for (int i =0; i < Session.Keys.Count; i++) { a[i] = Session[i].ToString(); } Response.Write(a.Length.ToString()); } }