Teach you how to solve the loss of ASP session

Source: Internet
Author: User
Tags sessions
Perhaps many ASP developers will encounter this situation: during the session (sessions) for no reason lost Sessio N. In other words, lost SessionID, the same session-level variables will be lost.

Many of the 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 assume that "/app/user.asp" and "/app/user.asp" are two different programs. It will automatically start a new session period. So, just be sure to unify the letters on your website.

Reason two:

Another reason is the value of session.timeout.

Timeout This property is used to set the time-out period of the session, in one-minute units. If a user does not refresh or request the page within a timeout period, the session will end (the SE ssion ends). When you request the page again, a new session will start.

Be sure that the value of timeout is the minute.

Format: session.timeout [= Nminutes]

Reason three:

If the user closes their browser's cookie, the session cannot be maintained. Because the session is kept on a cookie.

To keep the session state, the browser must support the cookie and be 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 the Global.asa

\virtual_root no Global.asa.

\another_virtual_root no Global.asa.

Call two virtual roots pages and execute the same global.asa (the one on root)

Another directory structure:

Root does not have Global.asa

\virtual released Global.asa.

\another_virtual_root another Global.asa

Each global.asa in a different directory executes, of course, the code that executes is different. But if the code inside is the same, don't say it. :)

So you are asking for different directories to be in the page, which will result in different global.asa being executed. Different variables are called, 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 dummy program, then go to the page of the parent virtual root on the previous level of the child virtual program. Those variables will be lost and destroyed. Look at the following table:

Request subroutine 1 missing subroutine 2 missing

Request Root First will not

Request Root only before subroutine 1 will not

Only request Root before subroutine 2 will

The last request to Root will be

"Recommended"

1. asp free Video Tutorial

2. Three ways to introduce session objects in ASP

3. Detailed use of Session in ASP

4. ASP Session Simple Example

5. A detailed introduction to the session in ASP

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.