ASPFAQs.com
Your source for ASP-related frequently asked questions and answers!


4GuysFromRolla.com : ASP FAQS : Session Object

Question: Can I disable the use of session variables on an ASP page-by-page basis?

Answer: There are times when you may wish to turn off the use of session variables for a certain set of ASP Web pages. For example, let's say that you have a website of 50 ASP pages, and four of these pages use Session variables. No matter what page you load, IIS has to prepare for the chance that that particular page might use Session variables; this preparation is called "Session tracking." According to the IIS Documentation, "Session tracking maintains information about a set of requests that are issued by a single client." This maintenance, of course, comes at a performance cost. Why, though, should this performance hit affect all of your ASP pages, even the ones that don't use Session variables?

It doesn't have to. You can explicitly tell IIS that you aren't using any Session variables for a particular ASP page. All you need to do is add this single line of code at the top of your ASP page:

<%@ ENABLESESSIONSTATE=False %>

By adding this line of code, you are informing IIS that it need not worry about Session tracking for the ASP page.

To learn more, check out: Using @ENABLESESSIONSTATE!


FAQ posted by Scott Mitchell at 10/15/2000 2:21:43 AM to the Session Object category. This FAQ has been viewed 47,054 times.


Copyright 2018 QuinStreet Inc. All Rights Reserved.
Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers