devxlogo

Disabling the session state to improve performances

Disabling the session state to improve performances

Sessions management consumes server’s resources and memory, thus, if you don’t use them in your application, you should disable them to improve performances. You can disable sessions for the entire application by setting to False the mode attribute in the web.config’s tag, as follows:

If you generally need session variables, but have some pages that don’t use them, you can disable session state just for those pages, by setting to False the EnableSessionState attribute in the @ Page directive, as shown below:

If you use session variables, but just in read mode, and don’t need to write them, you can set the EnableSessionState attribute to ReadOnly. The performances will not be as good as with disabled sessions, but it will still be better than with enabled sessions.

devx-admin

Share the Post: