I have been reading a xls file using ExcelDataReader and putting the complete DataTable in Session variable with following code
DataSet result = excelReader.AsDataSet(true,Convert.ToInt32(e.Parameter), 20);
if (result.Tables.Count > 0)
{
if (result.Tables[0].Rows.Count > 0)
{
Session["CellDirData"] = result.Tables[0];
}
}
In some other function i am getting this DataTable from Session Variable using following code
DataTable dtTemp = (DataTable) Session["CellDirData"];
dtTemp.Rows.RemoveAt(0); // Removing first row from local variable dtTemp
When i am removing first row from local variable dtTemp, it also update the Session variable ie now both dtTemp and Session["CellDirData"] has 19 rows.
My question is why Session get update while i am playing with local variable only ?