473,396 Members | 1,996 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,396 software developers and data experts.

Session Variables - Returns Error

I get the following error when I try to retrieve Session
Variables using this code:

Dim mstrPassword As String = CType(Session.Item
("gstrPassword"), String)

Exception Details: System.Web.HttpException: Session
state can only be used when enableSessionState is set to
true, either in a configuration file or in the Page
directive

According to everything that I have read and found this
is set to true. I have manually set it - checked in IS.

Does anyone have any ideas?

THANKS!

Jennifer
Jul 19 '05 #1
4 1988
Hi Jennifer

Is the line

Dim mstrPassword As String = CType(Session.Item("gstrPassword"), String)

declared at class level, or inside a Page event handler? It won't work at
class level. If this is the case then you need to declare your string, but
not access the session until Page_Init or Page_Load event occurs.

Does this help?
Joe

"Jennifer" <jz******@komputrol.com> wrote in message
news:01****************************@phx.gbl...
I get the following error when I try to retrieve Session
Variables using this code:

Dim mstrPassword As String = CType(Session.Item
("gstrPassword"), String)

Exception Details: System.Web.HttpException: Session
state can only be used when enableSessionState is set to
true, either in a configuration file or in the Page
directive

According to everything that I have read and found this
is set to true. I have manually set it - checked in IS.

Does anyone have any ideas?

THANKS!

Jennifer

Jul 19 '05 #2
-----Original Message-----
have u tried using
dim str as string = session("gstrpassword")
.


Joe directed me to get the values in the Page Load Event
instead of where I declared them as Module Level
Variables. That Worked.

Thank you for your response!
Jul 19 '05 #3
THANK YOU!!!

I needed to move the setting mstrPassword equal to the
Session Variable to the Page Load instead of where I dim
the Module Level Variable.

THANK YOU!!! This has been killing me.
-----Original Message-----
Hi Jennifer

Is the line

Dim mstrPassword As String = CType(Session.Item ("gstrPassword"), String)
declared at class level, or inside a Page event handler? It won't work atclass level. If this is the case then you need to declare your string, butnot access the session until Page_Init or Page_Load event occurs.
Does this help?
Joe

"Jennifer" <jz******@komputrol.com> wrote in message
news:01****************************@phx.gbl...
I get the following error when I try to retrieve Session Variables using this code:

Dim mstrPassword As String = CType(Session.Item
("gstrPassword"), String)

Exception Details: System.Web.HttpException: Session
state can only be used when enableSessionState is set to true, either in a configuration file or in the Page
directive

According to everything that I have read and found this
is set to true. I have manually set it - checked in IS.

Does anyone have any ideas?

THANKS!

Jennifer

.

Jul 19 '05 #4

Joe, this worked for me! Thank you!!
--
AcelgafritaPosted from http://www.pcreview.co.uk/ newsgroup access

Jul 22 '05 #5

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

Similar topics

4
by: Jonathan | last post by:
I use a Session ID to remember a user that's logged in on my site, which works pretty well for the most part, because index.html sends them to a page (index0.php) that starts the session and then...
3
by: Microsoft | last post by:
I am using Session variables in my ASP application. I have tested the application on a Win2k professional and it works fine. When the same web app is installed on a win2k advanced server from the...
4
by: Jennifer | last post by:
I get the following error when I try to retrieve Session Variables using this code: Dim mstrPassword As String = CType(Session.Item ("gstrPassword"), String) Exception Details:...
8
by: Dave Wurtz | last post by:
All, I'm new to ASP development and I have a basic design question: Is it ok to store business objects to session variables or is there a better way to keep object information? For example,...
5
by: Logickle | last post by:
Hi, all. I'm working on an application which requires communicating session info between separate web apps running on the same web server. The out of process server method sounded ideal, and...
14
by: Coleen | last post by:
Hi All :-) We have an APSX application using VB.net as the code behind, which uses one or two session variables per page. These Session variables are passed to the final page and calculations...
1
by: Henry | last post by:
Hi I'm new to the .net and session variables things, and I have a problem with my application in which I use session variables to transfer data between pages. when I leave the page for a few...
18
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
6
by: ChrisAtWokingham | last post by:
I have been struggling with unexpected error messages on an ASP.NET system, using SQL and C#. The application draws organisation charts, based on data stored in the SQL database. Some of the chart...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.