ASP 101 - Active Server Pages 101 - Web04
The Place ASP Developers Go!



Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash



 Top ASP 101 Stories Top ASP 101 Stories
Connections, Commands, And Procedures
What is ASP?
VBScript Classes: Part 1 of N

QUICK TIP:
Don't Use Select *
Show All Tips >>
ASP 101 RSS Feed ASP 101 Updates


Quick Tips


Read-Only Session State

The fact that ASP.NET maintains a user's session state for us is a great thing. It allows us to program applications for the Web and rarely give a second thought to the fact that we don't actually maintain a connection to our users. That being said, session state does come at a cost and disabling it when you're not using it is a standard tip for improving application performance. But what if you are using it?

There's a little known option that can serve as a happy medium. Instead of setting your page's EnableSessionState attribute to "True" or "False", you can set it to "ReadOnly" instead. The resulting page directive should look something like this:

<%@ Page Language="VB" EnableSessionState="ReadOnly" %>

This only works on pages that need access to a user's session state information, but do not modify it. If you take a close look at your application, you'll probably find that the majority of the pages that use session state fall into this category.

Using this setting won't give you the same performance benefit you'd get by disabling session state altogether, but then again you don't have to give up using sessions in order to use it.


Previous      Show All Tips      Next

If you have a tip you would like to submit, please send it to: webmaster@asp101.com.


Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers