title: figuring out why asp.net authentication ticket is expiring
body: <p>I need help figuring out why my authentication ticket is expiring after about an hour on my hosted website. But if I run the site locally the authentication ticket stays alive for the correct amount of time.</p>
  
  <p>This is my localhost web.config:</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
      &lt;forms loginUrl="~/Account/LogOn" timeout="20160" slidingExpiration="true" path="/" /&gt;
  &lt;/authentication&gt;
  </code></pre>
  
  <p>and this is my hosted web.config:</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
      &lt;forms loginUrl="~/Account/LogOn" timeout="20160" slidingExpiration="true" domain=".mywebsite.com" path="/" /&gt;
  &lt;/authentication&gt;
  </code></pre>
  
  <p>I know the authentication ticket is being created because:</p>
  
  <ul>
  <li>I can see it in the browser cookies</li>
  <li>I stay logged in even after closing the browser and reopening</li>
  <li>I stay logged in even after website recycles (changing and saving web.config to recycle it)</li>
  </ul>
  
  <p>When I check the cookie expiration date in the browser it's 2 weeks later. However, after about an hour my authentication always expires.</p>
  
  <p>What can I do to figure out why the hosted website's authentication is expiring so early?
  I don't know how to go about resolving this problem since it's my hosted website that is the only one having problems. </p>
  
  <p>Update 1: After waiting 1 hour, I check my browser and I see the cookie still exists. In fact it's expiration date is set for 2 weeks later. But if I reload the page or try going to any pages that requires authentication I am taken to the login page.</p>