HI hi hi,
I've got a little problem with some wayward session variables. Let me explain.
I am trying to persist an object to another page so naturaly I stuck it in the Session collection.
Right - so I carried on making my page, never stopping to think I might have a problem.
In my Page_Load event I added a redirect for if certain conditions were met.
Origionaly I didn't have the second clause in there - but I've been trying to debug this problem. Needless to say the conditional line executes and the page is redirected.
So now we're on our new page and I want that object back.
No matter what I do - my Session["DezRezUser"] object has gone. Session.Count == 0! So I did a scooby-doo double take with the classic "wuwwugh?" noise and I've spent the rest of the day trying to get my variable back.
Any ideas?
Yet another unchecked rambling brought to you by:
Oddball
I've got a little problem with some wayward session variables. Let me explain.
I am trying to persist an object to another page so naturaly I stuck it in the Session collection.
Code:
DezRezUser dru = new DezRezUser(AccessCode.Value, "448", BID.Value);
Session["DezRezUser"] = dru;
Right - so I carried on making my page, never stopping to think I might have a problem.
In my Page_Load event I added a redirect for if certain conditions were met.
Code:
if (responseUrl != null && Session["DezRezUser"] != null)
{
Response.Redirect(responseUrl);
}
Origionaly I didn't have the second clause in there - but I've been trying to debug this problem. Needless to say the conditional line executes and the page is redirected.
So now we're on our new page and I want that object back.
Code:
DezRezUser dru = null;
if (Session["DezRezUser"] != null)
{
dru = (DezRezUser)Session["DezRezUser"];
}
else // The user has not logging in.
{
Response.Redirect("~/DezRez/Login.aspx", true);
}
No matter what I do - my Session["DezRezUser"] object has gone. Session.Count == 0! So I did a scooby-doo double take with the classic "wuwwugh?" noise and I've spent the rest of the day trying to get my variable back.
Any ideas?
Yet another unchecked rambling brought to you by:
Oddball