When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips

Sections:
Sample Chapters
Commonly Asked Message Board Questions
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
XML Info
Information:
Feedback
Author an Article
ASP ASP.NET ASP FAQs Message Board Feedback
Print this page.
Published: Sunday, June 20, 1999

Using @ENABLESESSIONSTATE


Let me start by saying Session variables are not good. Note that I did not say that they were bad, just not good. Session variables have their Pros & Cons, but the cons can easily outweight the pros, especially if they are used heavily. However, there are times when Session variables are needed.

- continued -

So, 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. I hope this has been educational and helpful!

Happy Programming!


Related Articles:

  • Pros & Cons of Session Variables

  • ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article