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

Accessing Instance Class and Variables accross entire application

I am programming ASP.NET using C#.

I have been accessing static variables accross my entire application but now
need to change some of the static variables that are session specific to
instance variables.
(For more background, see previous post about 30 min ago)

It was so cool using static variables because they where global to the
entire application so I could calculate them when the page loaded and use
then anywhere in the app. Now I need to use instance variables so that there
will not be session conflicts but would still like to be able to access
those instance variables from anywhere. Is there a way of doing this?

Since my app always loads the same page and then loads user controls to
change pages, I can instance a class in the default.aspx page and set its
variables (properties or fields) for that page load. The question is how do
I make that instanced class and its members accessable to all other pages
within my application?

I suppose a session variable may be an option, but that seems less then
ideal...

Thanks for your help

Earl
Nov 15 '05 #1
2 1757
> I suppose a session variable may be an option, but that
seems less then ideal...


Why does that seem less than ideal? The session object is there to handle
session information. That is exactly what you want.

-JG
Nov 15 '05 #2
I guess I was hoping for a C# language way of doing this rather then an
ASP.NET way since this is such a core part of the application. On thing I
don't like about using a session variable is that it holds the object in
memory until it times out at the set timeout interval. Instance objects, on
the other hand, are passed to the garbage collector or destruction as soon
as they go out of scope. This meens that they are not wasting resources
hanging around in memory. Maybe I should look into a way of destroying the
session object once the page has loaded???

I could use C# to pass the variables from method to method but this gets to
be a mess also. (tons of passing variables)

Earl

"Juan Gabriel Del Cid" <jd*****@atrevido.nospam.net> wrote in message
news:OT**************@tk2msftngp13.phx.gbl...
I suppose a session variable may be an option, but that
seems less then ideal...


Why does that seem less than ideal? The session object is there to handle
session information. That is exactly what you want.

-JG

Nov 15 '05 #3

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

Similar topics

3
by: AdamM | last post by:
Hi all, When I run my VbScript, I get the error: "ActiveX component can't create object: 'getobject'. Error 800A01AD". Any ideas what I did wrong? Here's my VBScript: dim o set...
2
by: Nathan Sokalski | last post by:
I would like to access variables and functions that I declare in the Global.asax.vb file. However, I am having trouble doing that. What does the declaration have to look like in the Global.asax.vb...
2
by: George Durzi | last post by:
Consider these three projects: - ProjectWeb (my web application) - Facade (my class library, does data access, etc.) - Library (a library of classes I reuse in applications) ProjectWeb...
7
by: Göran Tänzer | last post by:
Hi, i've written a class which does some calculations for my web application. These informatinos are different for each page request - the current user is not important. i have about 10 aspx...
8
by: dwok | last post by:
I have been wondering this for a while now. Suppose I have a class that contains some private member variables. How should I access the variables throughout the class? Should I use properties that...
5
by: Cyril Gupta | last post by:
Hello, I have a class inside another class. The Scenario is like Car->Engine, where Car is a class with a set of properties and methods and Engine is another class inside it with its own set of...
6
by: Martin Eyles | last post by:
Hi, I have a .aspx page which has a .ascx file included through the lines <%@ Register TagPrefix="aspcustom" TagName="menu" Src="Menu.ascx" %> and <aspcustom:menu id="Menu1"...
12
by: titan nyquist | last post by:
I have a class with data and methods that use it. Everything is contained perfectly THE PROBLEM: A separate thread has to call a method in the current instantiation of this class. There is...
45
by: =?Utf-8?B?QmV0aA==?= | last post by:
Hello. I'm trying to find another way to share an instance of an object with other classes. I started by passing the instance to the other class's constructor, like this: Friend Class...
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
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: 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
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
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,...

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.