Freigeben über


Creating Sessionless ASP Pages

With ASP, you can also create sessionless pages which can be used to put off the creation of sessions tracking until needed.

Sessionless pages do not carry out the following:

  • Execute Session_OnStart procedures.

  • Send session ID cookies.

  • Create Session objects.

  • Access built-in Session objects or session scope objects created with the <OBJECT> tag.

  • Serialize execution with other session requests.

To configure an .asp file as sessionless, use the following:

<%@ EnableSessionState=False %> 

You should place this script as the first line in your .asp file, before any other scripts. The default, when this tag is omitted, enables session tracking.

Sessionless ASP pages can often improve the responsiveness of your server by eliminating potentially time consuming session activity. For example, consider the case of an ASP page containing two HTML frames: frames 1 and 2, both within one frameset. Frame 1 contains an .asp file that executes a complex script, while frame 2 contains a simpler .asp file. Because ASP executes session requests in sequential order, or serially, you will not be able to see the contents of frame 2 until the script in frame 1 has executed. However, if you make the .asp file for frame 1 sessionless, then ASP requests will no longer be serialized and the browser will render the contents of frame 2 before the contents of frame 1 have finished executing.

Unfortunately, the way in which multiple requests for different frames are processed ultimately depends on the configuration of the user's Web browser. Certain Web browsers may serialize requests despite the sessionless configuration of your .asp files.