title: Setting cookie expiration with ASP classic to ASP.NET session sharing solution
body: <p>I'm implementing the session sharing structure from <a href="http://msdn.microsoft.com/en-us/library/aa479313.aspx" rel="nofollow noreferrer">this link</a> for an ASP classic site to begin the gradual conversion process to ASP.NET. I'm trying to extend the cookie expiration time so that users do not get signed out of the site when the session expires. At the place where the cookie is created in SessionPage.cs I've added the line in the CreateNewSessionCookie() method:</p>
  
  <pre><code>cookie.Expires = DateTime.Now.AddDays(14);
  </code></pre>
  
  <p>Now this works fine, however, it only works if the user first visits an ASP.NET page, and <em>then</em> visits the ASP classic pages. It doesn't work if visiting an ASP classic page <em>first</em> (looking at the cookie through firefox confirms that different expiration values are given based on if I visit an ASP or ASP.NET page first.) I'm still a bit fuzzy on the mechanics behind this implementation as I don't have a complete understanding of session and cookie handling. However, I would have thought that the VB6 SessionMgr object is calling the SessionUtility DLL, and thus is using the same code to issue the cookie. I have re-registered the SessionUtility using gacutil, and re-exposed it using regasm. How else is the cookie being issued when a user accesses an ASP classic page? How can I change the expiration time?</p>