Does the ASP.Net Session variable store the actual value or just a reference?
I have the following code where I am collecting data stored in session in a local variable and updating the datatable. The next time I access the session, the updated values are updated. (in my case, the first line was removed, which was selected for the objTable1 variable):
protected void Page_Load(object sender, EventArgs e)
{
DataTable objTable = (DataTable)Session["dTable"];
objTable.Rows[0].Delete();
DataTable objTable1 = (DataTable)Session["dTable"];
}
I thought local variables make a copy of the session variable and update it without updating the session variable.
Sincerely.
+3
source to share
1 answer