Internet Explorer maintains a session count that tracks the number of instances of the browser window in the logon session. Whenever the logon session count becomes 0, the process that closes the last window ends the Internet session by calling the
InternetSetOption function (
INTERNET_OPTION_END_BROWSER_SESSION). This technique causes the symptoms that can appear in two common situations:
- When you host the WebBrowser control
Run an application, and then open a window that hosts the WebBrowser control. When you locate a Web site that maintains a session and then close the window of that session, if that window was the last window that displayed the WebBrowser control in all of the logon session, your memory cookies disappear, including your session ID. In the same running process, when you reopen that window and return to the site, you are in a different session. - When you start Internet Explorer from a file-based URL instead of an HTTP-based URL
You may lose your session state if you follow these steps:- Set your home page to C:\MyDoc\MyHome.htm.
- Make sure that you have no active instances of either Internet Explorer or the WebBrowser control.
- Click a URL that maintains a session ID to start Internet Explorer, and then locate a Web site.
- Open a new window, which becomes the second window in the logon session, and then close the window.
NOTE: You may not lose your session state if your computer is on for several hours. Various conditions can cause Internet Explorer to lose track of its session count over the time of the logon session.
The problem does not occur if another instance of Internet Explorer is running in another process. Internet Explorer maintains its session count for all of the computer. Sometimes, you may not experience the problems that are described in this article. This is because some situations cause Internet Explorer not to decrement the session count. The longer your logon session, the more likely you are not to experience these problems.