Maybe many asp developers will encounter this situation: the session is lost for no reason during the session. In other words, if the SessionID is lost, the same session-level variables will also be lost.
Many reasons for session loss are due to incorrect programs or incorrect virtual directory structures.
SessionID changes for the following reasons.
Reason 1:
Netscape's browser will think that "/App/user.asp" and "/app/user.asp" are two different programs. It will automatically start a new session (new session). Therefore, the capitalization of letters must be unified on your website.
Reason two:
The other reason is the value of Session.Timeout.
The Timeout attribute is used to set the Session timeout in units of one minute. If a user does not refresh or request the page within a Timeout, the session ends. When you request the page again, a new session will start.
Make sure the value of Timeout is minutes.
Format: Session.Timeout [= nMinutes]
Reason three:
If the user turns off their browser's cookie, of course the session Just can't keep it. Because session retention depends on cookies.
To maintain the Session's status, the browser must support cookies and be in an open state. Of course you can use other methods
Reason 4:
A common mistake is to create an incorrect directory structure. Like the following directory structure:
root has global.asa
\virtual_root without global.asa
\another_virtual_root without global.asa
Call two A virtual roots page will execute the same global.asa (the one on root)
Another directory structure:
root does not have global.asa
\ virtual puts global.asa
\another_virtual_root and another global.asa
Each global.asa in a different directory will be executed separately. Of course, the executed code will be different. But if the code inside is the same, don't say anything. :)
So when you request pages in different directories, different global.asa will be executed. Different variables are called, different session ids are created...all the previous useful information is destroyed.
The following is a detailed explanation:
When you first browse the page on the child virtual application (child virtual application), and then browse the parent of the child virtual application The page of the virtual program (parent virtual root). Those variables will be lost and destroyed. Look at the Form below :
requested subroutine 1 loss subroutine 2 lost
first requesting ROOT not. Requesting Root before will not happen
Requesting Root only before subroutine 2 will not
Last request Root will do
[Related recommendations]
1.
Free video tutorial on ASPIntroducing the three methods of Session object in ASPDetailed explanation of Session in ASP Usage skills Simple example of ASP sessionDetailed introduction to session in ASPThe above is the detailed content of Teach you how to solve the problem of ASP session loss. For more information, please follow other related articles on the PHP Chinese website!