Perhaps a lot of ASP developers will encounter the situation: during the session (sessions) for no reason lost Sessio N. In other words, if you lose SessionID, the same session-level variables will be lost.
Many sessions are missing because of the wrong program or the wrong virtual directory structure.
There are several reasons for the SessionID change.
Reason one:
Netscape's browser will consider "/app/user.asp" and "/app/user.asp" to be two different programs. It automatically starts a new session. Therefore, only on your site must unify the case of letters.
Reason two:
Another reason is the value of session.timeout.
Timeout This property is used to set the timeout time for the session, in one minute. If a user does not refresh or request a page within a timeout time, the session will end (the SE ssion ends). When you request a page again, a new session will begin.
Be sure that the value of timeout is minute.
Format: session.timeout [= Nminutes]
Reason three:
If users turn their browser cookies off, the session cannot be maintained. Because the retention of the session is to rely on cookies.
To keep the session state, the browser must support cookies, and in the open state. Of course you can do it in other ways.
Reason four:
The common mistake is to create the wrong directory structure. Like the following directory structure:
Root put Global.asa.
\virtual_root no Global.asa.
\another_virtual_root no Global.asa.
Calling two virtual roots pages, the same Global.asa is executed (the one on root)
Another directory structure:
Root has no Global.asa.
\virtual put Global.asa.
\another_virtual_root another global.asa.
Each of the different directory Global.asa will be executed, of course, the implementation of the code is different. But if the code inside is the same, make it stop. :)
So you're requesting a different directory page, which will cause different Global.asa to be executed. Different variables are invoked and different session IDs are created .... Previous useful information has been compromised.
The following is a detailed explanation:
When you first browse the page (Child virtual application) on the subweb, then browse to the page of the parent virtual program at the previous level of the child virtual program. Those variables will be lost and corrupted. Look at the table below:
Request subroutine 1 missing subroutine 2 missing
Ask Root first.
Requesting root only before subroutine 1 will not
Request Root only before subroutine 2 will
The last request root will be
There is a registry key value (registry entry) called Checkfornestedvroots (the default is 1). is to set whether the ASP to detect other directories in the Global.asa files.
If a page is requested, but if the file is not global.asa in the same directory as the requested page, then the ASP will go to the superior directory to look for it. This is the case for ASP design. On the other hand, if the application page is on root and Global.asa is root, then the ASP executes the Global.asa file on root. There is no need to find the Global.asa file in the subdirectory.
Internet Service Manager, you can set a directory into a virtual directory, such a directory can have their own global.asa files, of course, Application_OnStart and Session_OnStart is indispensable (nonsense).
This is an example. They all have Global.asa.
C:\InetPub\wwwroot <Home>
Global.asa
C:\InetPub\wwwroot\Test2 (Nested)
Global.asa
C:\InetPub\wwwroot\Test2\Test3 (Nested)
Global.asa
C:\InetPub\wwwroot\Test4
Global.asa
Attention:
If authentication is required for Global.asa file Web requests, the variables initialized during the Sessi On_onstart of the Global.asa file will be empty. If your Global.asa's permission is really the case, then it will be a lot of trouble. For example, you will see an error message like this:
Microsoft OLE DB Provider for ODBC Drivers error ' 80004005 [Microsoft][odbc Driver Manager] Data source name not found and No def ault driver specified/<web name>/<asp filename>.asp, line xx
This is because the session variable initialized in Session_OnStart is empty (it is not initialized at all).
In addition: This problem does not exist on the Win95. More accurately, there is no such problem in a file system with no file permission settings like fat. So the NT NTFS has this problem, but Win9 5,98 is not.
Therefore, you must set the Internet anonymous Read permission for the Global.asa file so that the problem does not occur.