473,779 Members | 2,063 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Htt pContext.Curren t.Session.Add(" objectname",
customobject)"
and we receive the following error message:
"Session state can only be used when enableSessionSt ate 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 2253
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["MyStoredTy pe"];

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.Htt pContext.Curren t.Session.Add(" objectname",
customobject)"
and we receive the following error message:
"Session state can only be used when enableSessionSt ate 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
3025
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 access to the methods and properties from the Page_Load, no problem there. But as soon as I want access to the user control from another procedure on the same page, I get the next error message: "Object reference not set to an instance of an...
2
1614
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 bounce the web server. The error can be seen below. I have looked at the stack trace and determined where the error is occuring but when I look at my code, where it says that I have an unhandled exception, I have error handling to handle it. ...
9
3927
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', 'Scripting', 'Scripting.FileSystemObject', and a few others However, when I try to create the fso object I keep receiving an error. 'ActiveX component can't create object: 'Scripting.FileSystemObject'
2
1315
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 NewThread.Start() Response.Redirect("loading.aspx")
3
2883
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 step 1 of the wizard and saved into a session variable. In step 2, when the user clicks on a button, I load the design data from the session variable and these are saved for further handling in a HashTable. The HashTable is defined in the...
3
1313
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 (3a) /default.aspx loads ( yay! ) (3b) while the client is loading the page.. we continue to add items to the session
2
2338
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. -------------------------------------------------------------------------------- Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack...
7
1184
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 the session no more exists. Can anybody please tell me how to handle that error.
0
9474
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10074
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9930
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7485
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.