It's an odd one. My master page Page_load seems to run AFTER the pages Page_load. Basically I'm trying to catch if a user is logged in / session is still active and if not, redirect them to the login page. But it falls over because it hits the individual pages page_load. I don't really want to have to put the check on each page.
Master page:
public partial class Cafe : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserName"] != null)
{
// lblName.Text = (string)Session["FirstName"];
}
else
{
Response.Redirect("~/login.aspx");
}
}
}
}
When I put a breakpoint in, the one on the page (take default.aspx for example) gets hit first, then the one on the master page