citizenzen
Programmer
Hello.
Earlier I posted a question about using sessions, but I am still having issues.
I have 2 pages:
page1.aspx and page2.aspx
on page1.aspx, the user locates media. The located media needs to be passed to page2.aspx for checkout. this media will be placed in a new datagrid with the session values and it is extracted from a dataset. So, it seemed like a great idea to place the dataset into a session on page1.aspx. But the sessions is not being recognized at all. I also tried to place on the values from the session:
Error message from page2.aspx:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Important Issues:
1) How do I resolve the issue with the sessions? Is it my syntax?
2) Why are the sessions not being recognized? I have seen examples where a dataset is placed in a session, but I can't figure out how to grab the values on the following page.
3) Should the extracted sessions not be placed in the page load event?
4) How do i successfully extract values from the dataset that is in the session?
Earlier I posted a question about using sessions, but I am still having issues.
I have 2 pages:
page1.aspx and page2.aspx
on page1.aspx, the user locates media. The located media needs to be passed to page2.aspx for checkout. this media will be placed in a new datagrid with the session values and it is extracted from a dataset. So, it seemed like a great idea to place the dataset into a session on page1.aspx. But the sessions is not being recognized at all. I also tried to place on the values from the session:
Code:
page1.aspx;
//also tried the following
Session.Clear();
Session.Add("MyData", locmedia);
Session.Clear();
Session.Add("Video", strVideoout);
Session.Add("TapeID", intTapeIDout);
page2.aspx;
//testing
string video = Session["Video"].ToString();
string tapenum = Session["TapeID"].ToString();
DataSet dstData = (DataSet)(Session["MyData"]);
//placed here for testing only to determine if sessions really exist
Response.Write(Session.Count + "<br>");
for (int i = 0; i < Session.Count; i++)
{
Response.Write(Session.Keys[i].ToString() + "<br>");
}
Error message from page2.aspx:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Code:
web.config
<system.web>
<sessionState mode="InProc" />
Important Issues:
1) How do I resolve the issue with the sessions? Is it my syntax?
2) Why are the sessions not being recognized? I have seen examples where a dataset is placed in a session, but I can't figure out how to grab the values on the following page.
3) Should the extracted sessions not be placed in the page load event?
4) How do i successfully extract values from the dataset that is in the session?