hi all, i really need your help.. can u correct my code to delete session below?
thx before...

protected void GridView_Main_RowCommand(Object sender, GridViewCommandEventArgs e)
    {
        
        if (e.CommandName == "Erase")
        {
            string childId = Convert.ToString(e.CommandArgument);
            IList dataUserList = new ArrayList();
            if (Session["UserList"] != null)
            {
                dataUserList = (IList)Session["UserList"];

                foreach (UserList data in dataUserList)
                {
                    UserList tujuanAkses = (UserList)data;

                    if (tujuanAkses.IdUser.Equals(childId))
                    {
                        Session.Remove(tujuanAkses.NamaUser);
                        Session.Remove(tujuanAkses.HakAkses);
                    }
                }
            }
         }
    }

Use Session.Abandon() method.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.