I\'m surprised I couldn\'t find any answers.
How do I set my sessionid in my cookie to expire at the end of session? (when the browser closes or the user has been in
TimeOut returns an int, Expires expects DateTime, which is why that code will not compile. Setting the expiration date to date in the past immediately revokes the cookie, so that's probably not what you want. If you left the expiration date unused, the cookie would expire as soon as the user closed the browser.
If you want the cookie tied to the particular Session, why involve the cookie in the first place? You could certainly keep extending the cookie's expiration date each time the user extended the session by using your application, but that seems like unnecessary work. Just use Session.
Feel free to elaborate on the problem.