How to check if enableSessionState is on w/o triggerring exception

  • Thread starter Thread starter Vlad Hrybok
  • Start date Start date
V

Vlad Hrybok

This one should be simple, but I can't find the answer in MSDN.

There are cases when it's necessary for controls, master pages and other
reusable units of code-behind to determine at run time whether Session state
support is enabled. Simply checking if(this.Session != null) is not working -
producing HttpException.

I would like to find a less expensive, exception-free way to check whether
session state support is turned on for the current page (I know I can read
web.config, but I am interested in checking individual page's setting, and
not whole app's).

Thank you,
 
Back
Top