F
Frank Esser
Hi,
I created a base class for my project from that all other pages inherit.
Within this page in the OnLoad event I set some session object variables.
My intention is that first of all the OnLoad event is fired on each page
load and then the specific Page_Load event of the specific page.
But whenever the OnLoad event in the base class is fired the Session object
is empty again.
What am I doing wrong?
Here is my code:
public class MyBasePage : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
protected override void OnLoad(EventArgs e)
{
// on each page load make sure that everything is available
if (Session["test"] == null) Session["test"] = "Just a test";
// calls the page specific OnLoad event
base.OnLoad(e);
}
}
public class WebForm1 : MyBasePage
{
private void Page_Load(object sender, System.EventArgs e)
{
...
}
}
I created a base class for my project from that all other pages inherit.
Within this page in the OnLoad event I set some session object variables.
My intention is that first of all the OnLoad event is fired on each page
load and then the specific Page_Load event of the specific page.
But whenever the OnLoad event in the base class is fired the Session object
is empty again.
What am I doing wrong?
Here is my code:
public class MyBasePage : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
protected override void OnLoad(EventArgs e)
{
// on each page load make sure that everything is available
if (Session["test"] == null) Session["test"] = "Just a test";
// calls the page specific OnLoad event
base.OnLoad(e);
}
}
public class WebForm1 : MyBasePage
{
private void Page_Load(object sender, System.EventArgs e)
{
...
}
}