473,396 Members | 2,011 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.

Error loading object into Session

We have developed an ASP.NET application that uses a custom component that
we developed.

We are trying to load the custom component into the session state using
"System.Web.HttpContext.Current.Session.Add("objec tname",
customobject)"
and we receive the following error message:
"Session state can only be used when enableSessionState is set
to true, either in a configuration file or in the Page directive."

We have configured session state in both the page and the Web.Config. Is
there an additional step so allow for adding objects to the session? Also, it
is permitted to load objects into the session, correct?

Any assistance would be greatly appreciated.

--
Respectfully,

Andrew Corley
MCSD, MCDBA, Master CIW Designer
Nov 18 '05 #1
1 2241
Andrew,

Yes, objects can be loaded into the session state contents, from which you
will need to declare the type when retrieving:

MyType myvar = (MyType) Session["MyStoredType"];

Additionally, check your IIS settings to ensure that the website
configuration is allowing session state. That setting is located in
Properties > Home Directory > Configuration (Applications Settings) > Options

"Enable Session State" should be checked.

I hope this helps!

Thanks,
Ian Suttle
http://www.IanSuttle.com

"Andrew Corley, MCSD, MCDBA" wrote:
We have developed an ASP.NET application that uses a custom component that
we developed.

We are trying to load the custom component into the session state using
"System.Web.HttpContext.Current.Session.Add("objec tname",
customobject)"
and we receive the following error message:
"Session state can only be used when enableSessionState is set
to true, either in a configuration file or in the Page directive."

We have configured session state in both the page and the Web.Config. Is
there an additional step so allow for adding objects to the session? Also, it
is permitted to load objects into the session, correct?

Any assistance would be greatly appreciated.

--
Respectfully,

Andrew Corley
MCSD, MCDBA, Master CIW Designer

Nov 18 '05 #2

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

Similar topics

1
by: Martine | last post by:
Hi there! I have a problem with programmatically adding user controls to my mobile webforms. If I load my usercontrol programmatically (in the Page_Load), the object is instantiated, I have...
2
by: James Wallace | last post by:
I hope that someone can help me out there with this problem. I get an itermittant problem with our web page that occurs about once every 10 to 15 days where the only way to fix the problem is to...
9
by: kermit | last post by:
I keep seeing that you can use the FileSystemObject in either VB script, or Javascript on an aspx page. I added a refrence to the scrrun.dll I added importing namespaces for 'System.Object',...
2
by: Jeremy Cowles | last post by:
Hi all, Here is the issue: On postback, I spawn a new thread using the following code: Dim NewThread As New Thread(AddressOf ProcessFile) NewThread.Priority = ThreadPriority.Lowest...
3
by: Michel Couche | last post by:
Hello, I have an ASP.Net application that uses the Wizard control to build a newsletter. There are three steps in the wizard. The customer's specific design data are loaded from a database in...
3
by: =?Utf-8?B?a3lvbmc=?= | last post by:
hey, i'm trying to figure out how i would load items to the session after the reponse has been sent out. (1) so user goes to /default.aspx (2) server does it's thing and sends response back...
2
by: arun1985 | last post by:
In the project i am using i am having the following code and when i upload it to the server.Its givig me the following error in the global.cs file. Server Error in '/' Application. ...
7
by: Gouri.Mahajan7 | last post by:
Hello, I am new to asp.net. when i close the browser programmatically I am getting an application error at the line given below. <param name="SessionID" value="<%= Session %>"/> because of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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: 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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.