title: Strange logging off on ASP.NET 3.5 website
body: <p>Please help me I'm getting desperate here trying to find the problem, and I don't know where to start looking for it.</p>
  
  <p>Here are the symptoms:</p>
  
  <p>I've noticed, that when a user logs on in the morning, he is then immediately logged off, then when he logs on again, everything is fine and he can work on the site.</p>
  
  <p>Every once in a while, when the user clicks a link, the page takes a lot of time to load, but it never actually loads, and the user is thrown to the login page.</p>
  
  <p>Also, after an Exception has occurred in the website, the user is then thrown to the login page. It's as if the exception clears somehow the session.</p>
  
  <p>Do any of you know of a situation where this might happen ?</p>
  
  <p>The code I use in every page in my application is as follows :</p>
  
  <pre><code>If (Not User.Identity.IsAuthenticated) Then  
      Response.Redirect("../login2.aspx")
  End If  
  
  ' If session timeout then return to login screen '
  If ((Session("LocationId") Is DBNull.Value) Or (Session("LocationId") Is Nothing)) 
  Then  
     Response.Redirect("../login2.aspx")   
  End If
  </code></pre>
  
  <p>The code in the web.config:</p>
  
  <pre><code>&lt;sessionState cookieless="false" timeout="600" /&gt;
  &lt;authentication mode="Forms"&gt;
  &lt;forms timeout="600" /&gt;
  &lt;system.web&gt;
      &lt;authorization&gt;
          &lt;allow users="*"/&gt;
      &lt;/authorization&gt;
  &lt;/system.web&gt;
  </code></pre>