title: Do Session variables expire after different amount of time?
body: <p>In my Login page I put connection string and the logged in user role in to session variables. To check if the session has not expired I put the following lines of code into the page_load event of the other pages.</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
     if (Session["userRole"])==null
        Response.Redirect("Login.aspx");
  
     .........
  }
  </code></pre>
  
  <p>But I get <code>Session[conString] is expired</code> error sometimes when the web application is idle for a while. Now I wonder if the expiration times are different for different session variables. If not, then shouldn't I be redirected to the Login page when the application detects that the session is expired?</p>