473,395 Members | 2,796 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,395 software developers and data experts.

Reference types in Session

I have just completed a walkthrough exercise in a MS book and noticed that
while the instance of a new class was put into session when the page was
created, it was only ever retrieved on subsequent postbacks (it was not
placed back into a session variable at any point in the program).

Is this because a class maintains just a reference to the object in Session,
or am I missing something else?
Jan 19 '06 #1
1 1504
I think you got it.

The value in the session is just a memory address pointing to the data on
the HEAP. All references, whether you create a new var and assign it to the
old, or pass it as a parameter, as all pointing to the same data on the
heap, change one and you change all.

Karl

--
http://www.openmymind.net/

"Dundealing" <Du********@discussions.microsoft.com> wrote in message
news:BE**********************************@microsof t.com...
I have just completed a walkthrough exercise in a MS book and noticed that
while the instance of a new class was put into session when the page was
created, it was only ever retrieved on subsequent postbacks (it was not
placed back into a session variable at any point in the program).

Is this because a class maintains just a reference to the object in
Session,
or am I missing something else?

Jan 19 '06 #2

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

Similar topics

7
by: kon george | last post by:
Can somebody assist. I build this code on a dev laptop and copied across the entire code to a Windows 2003 server with 1.1 framework. It is basic ASP.NE T that uses web service for SQL Server...
7
by: TS | last post by:
I was under the impression that when you get a reference to an object, then update that reference, the object gets updated. Apparently this isn't the case using session? code (note at this point...
4
by: Steve Richter | last post by:
this code compiles ok: public string AssureAnonUID( ) { if (Session == null) Session = Guid.NewGuid(); return Session.ToString(); } but this code does not: public string AssureAnonUID( )
3
by: Alexander Widera | last post by:
hi, i have the following problem in the following code: Basket basket = (Basket) Session; if (basket.isEmpty) { ........... }
0
by: Richard Gregory | last post by:
Hi, I have the wsdl below, for an Axis web service, and when I select Add Web Refernce in Visual Studio the proxy is missing a class representing the returnedElementsType (see reference.cs below...
22
by: Vagif Abilov | last post by:
We have several Web projects where we suddenly began experiencing various problems after porting them to .NET 2.0. I debugged one of them and here's what I've found: In one of referenced...
35
by: Chris | last post by:
Hi, I tried to create a class which must change the propety 'visible' of a <linktag in the masterpage into 'false' when the user is logged. But i get the error: "Object reference not set to an...
4
by: =?Utf-8?B?QWxla3MgS2xleW4=?= | last post by:
When I call sub in VB I can sent value of variable or reference to this value. The question is. Suppose I have class public class AA .... end class and declare object of this class dim objAA as...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
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
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
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
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,...

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.