473,402 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

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

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,

--
Vlad Hrybok
http://UltiDev.com
Nov 12 '08 #1
2 3968
use:

if (this.Context.Session != null)
-- bruce (sqlwork.com)

Vlad Hrybok wrote:
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,
Nov 12 '08 #2
It worked, thank you, Bruce.
--
Vlad Hrybok
"bruce barker" wrote:
use:

if (this.Context.Session != null)
-- bruce (sqlwork.com)

Vlad Hrybok wrote:
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,
Nov 12 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: StepH | last post by:
Hi, I've this module : from optparse import OptionParser import re _version = "P1" def writeVar(f, line):
6
by: benben | last post by:
Why doesn't the following code work? template <typename ExceptionT> void f(void) throw (ExceptionT) { throw ExceptionT(); } Ben
1
by: stuart | last post by:
Hi, Is it possible to find out if an exception has an inner exception or not. for example if I catch an exception of type "System.Web.HttpException" it is likely (but not definate) that the...
2
by: André Nogueira | last post by:
Hi there! I am developing an Windows Explorer-like application that will tell you the size of any folder. But so far I have come across some problems. For instance, you may not have access to all...
11
by: l.woods | last post by:
I want to set up my CATCH for a specific exception, but I really don't know which one of the multitude that it is. I am getting the exception now with Catch ex as Exception but I want to be...
1
by: yancheng.cheok | last post by:
Hi all, According to "How can I handle a constructor that fails?" in http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.2, whenever there is a constructor fail, we will throw...
41
by: Zytan | last post by:
Ok something simple like int.Parse(string) can throw these exceptions: ArgumentNullException, FormatException, OverflowException I don't want my program to just crash on an exception, so I must...
11
by: greg | last post by:
I have been struggling with the following issue: How can one find the type of the exception? In other words I would likes to come up with piece of code that does the following (written in pseudo...
3
by: Miro | last post by:
I cant seem to find an example on how to do something, ( vb2005.express ) i have a Try ListeningSerialPort.Open() TestText.Enabled = True Catch ex As Exception 'Debug.WriteLine(ex.Message)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.