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

Storing objects in Session

I am trying to persist an instance of my class between asp pages and cannot get it to work consistently. I have one class that implements iEnumerator, that works fine. I have another class that does not implement IEnumerator, I can store the object in Session. When I retrieve it from Session in a different page it behaves as if it's never been created before, I always have to create a new one

I'm thinking it has to do with if a class creates a new class (such as IEnumerator)
Nov 18 '05 #1
4 1596
Hi,

can you post the code for your problematic class (simplified will do if it
is long one)

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"Anthony Reynolds" <an*******@discussions.microsoft.com> wrote in message
news:30**********************************@microsof t.com...
I am trying to persist an instance of my class between asp pages and cannot get it to work consistently. I have one class that implements
iEnumerator, that works fine. I have another class that does not implement
IEnumerator, I can store the object in Session. When I retrieve it from
Session in a different page it behaves as if it's never been created before,
I always have to create a new one.
I'm thinking it has to do with if a class creates a new class (such as IEnumerator)?

Nov 18 '05 #2
Hi,

can you post the code for your problematic class (simplified will do if it
is long one)

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"Anthony Reynolds" <an*******@discussions.microsoft.com> wrote in message
news:30**********************************@microsof t.com...
I am trying to persist an instance of my class between asp pages and cannot get it to work consistently. I have one class that implements
iEnumerator, that works fine. I have another class that does not implement
IEnumerator, I can store the object in Session. When I retrieve it from
Session in a different page it behaves as if it's never been created before,
I always have to create a new one.
I'm thinking it has to do with if a class creates a new class (such as IEnumerator)?

Nov 18 '05 #3
Double check your index names both in global.asax and in the pages to
make sure they match. This happened to me when I had mispelled one of
them. They have be EXACTLY the same.

"Anthony Reynolds" <an*******@discussions.microsoft.com> wrote in message news:<30**********************************@microso ft.com>...
I am trying to persist an instance of my class between asp pages and cannot get it to work consistently. I have one class that implements
iEnumerator, that works fine. I have another class that does not
implement IEnumerator, I can store the object in Session. When I
retrieve it from Session in a different page it behaves as if it's
never been created before, I always have to create a new one.
I'm thinking it has to do with if a class creates a new class (such as IEnumerator)?

Nov 18 '05 #4
Double check your index names both in global.asax and in the pages to
make sure they match. This happened to me when I had mispelled one of
them. They have be EXACTLY the same.

"Anthony Reynolds" <an*******@discussions.microsoft.com> wrote in message news:<30**********************************@microso ft.com>...
I am trying to persist an instance of my class between asp pages and cannot get it to work consistently. I have one class that implements
iEnumerator, that works fine. I have another class that does not
implement IEnumerator, I can store the object in Session. When I
retrieve it from Session in a different page it behaves as if it's
never been created before, I always have to create a new one.
I'm thinking it has to do with if a class creates a new class (such as IEnumerator)?

Nov 18 '05 #5

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

Similar topics

14
by: mjkahn | last post by:
I've read (and read!) that you shouldn't store objects in Session variables. I've read these reasons: - The object takes up memory that may not be freed until the session times out. Better to...
0
by: Sandra | last post by:
I am using a VB6 COM object with an asp.net project. I am storing the COM object in a session variable but am having a problem accessing the COM object from the session variable. I am getting...
2
by: jakk | last post by:
Below is the exception that Iam getting. It says that the DataView that Iam storing in the session is not Serializable. BUt works fine if I store in the inproc session and fails if I switch to...
2
by: Curt tabor | last post by:
Hi, I have several pages in my app that all use the same oleDBConnection(s). When this connection gets created, I store it as a Session variable so that other pages can access it w/o having...
10
by: Mark Rae | last post by:
Hi, This relates to the previous thread "Disappearing Sessions", but is a bit more generic so I thought I'd start a new thread. This one relates to the storing of objects in Session once only to...
9
by: david | last post by:
I have a class with some business-logic and with every roundtrip, I need an instance of this class, so I have to create it, every time again. That doesn't seem very efficient. I thought it would...
2
by: Mythran | last post by:
We followed an example found on MSDN to create an encrypted FormsAuthenticationTicket and storing the ticket in a cookie. Is this the "correct" way to store the authentication ticket? We are...
3
by: RSH | last post by:
Hi, I have a situation where I have created an object that contains fields,properties and functions. After creating the object I attempted to assign it to a session variable so i could retrieve...
4
by: =?Utf-8?B?YmFzdWxhc3o=?= | last post by:
Hi; I want to store a datatable (or an arraylist) as a session variable but when I try; Session = al_RecNo; I get an error that; "Cannot implicitly convert type...
6
by: J055 | last post by:
Hi I have the following code. I upload an XML file using the FileUpload object, store the stream in a session so the user gets the chance to confirm some options then pass the stream from the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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:
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...
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.