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

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top