title: Page_Load does not fire in ASP.NET WebForms
body: <p>I have 3 .ASPX pages.  They are </p>
  
  <pre><code>`Login.aspx`
  `Agent.aspx` and 
  `Scheduler.aspx`
  </code></pre>
  
  <p>After user enter the credentials he gets directed from Login page to Agent.aspx or Scheduler.aspx based on his roles. Inside the <code>Page_Load()</code> for each page, I again check the role of the user.  If the criteria does not match he gets redirected back to Login.aspx.</p>
  
  <p>The <code>Page_Load()</code> is called when I navigate like this:</p>
  
  <p>Login->Agent if i logout from agent page i get redirected to Login page but now if i enter the URl of agent page the <code>Page_Load()</code> inside the Agent.aspx is not loaded .
  What is the mistake?</p>
  
  <p>Login page aspx   ------</p>
  
  <pre><code>public partial class LOGIN : System.Web.UI.Page
  {  
    protected void Page_Load(object sender, EventArgs e)
      { 
          txtUserName.Focus();
      }
  
      protected void btnLogin_Click(object sender, EventArgs e) 
  
      {
          bool validLogin = false;
  
     LoginHandler loginhandler = new LoginHandler();
  
      validLogin = loginhandler.IsValidUser(txtUserName.Text.Trim(),                        txtPassword.Text.Trim());
      int RoleId = loginhandler.FindRoleId(txtUserName.Text.Trim(), txtPassword.Text.Trim());
      if (validLogin)
      {               
          FormsAuthentication.RedirectFromLoginPage(txtUserName.Text.Trim(), false);
          if (RoleId == 1)
             Response.Redirect(Constant.GoToAgentView);
          if (RoleId == 2)
             Response.Redirect(Constant.GoToSchedulerView);
      }
       else
          Server.Transfer(Constant.GoLoginPage);
  
  
      }
   }
  </code></pre>
  
  <hr>
  
  <p>Agent aspx---</p>
  
  <pre><code> public partial class Agent : System.Web.UI.Page
      {
          CSBuss.Agent.AgentHandler agent = new CSBuss.Agent.AgentHandler();
          LoginHandler login = new LoginHandler();
  
          protected void Page_Load(object sender, EventArgs e)
  
          {
  
              string rolename = login.FindRoleName(User.Identity.Name);
              if (string.Compare(rolename, "Agent", false) == 0)
              {
                  SuccessPanel.Visible = false;
                  DisplayPanel.Visible = true;
                  txtName.Focus();
                  if (!IsPostBack)
                  {
                      DropDownList1.DataSource = agent.GetCabType();
                      DropDownList1.DataTextField = Constant.DisplayCabType; // CabType to be displayed in the list items
                      DropDownList1.DataValueField = Constant.DisplayCabID; // CabId of the items displayed
                      DropDownList1.DataBind();
  
                  }
              }
              else
                  Server.Transfer(Constant.GoLoginPage);
  
          }
    }
  </code></pre>
  
  <p>PS : Ive set Enableoutputcaching to false and Identity Impersonate to false in Web.config file</p>