473,394 Members | 1,641 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.

Scoping of components

Is there any mechanism in an ASP.Net application to scope components? I
know that forms and the like are set to a request scoping and that is
fine, but there are certain components I need to have a global scope and
some a session scope.

Nov 18 '05 #1
4 1090
Um.. You can use the Session, Application or Cache for that.

--
Girish Bharadwaj
http://msmvps.com/gbvb
"No One" <no***@yahoo.com> wrote in message
news:41***************@yahoo.com...
Is there any mechanism in an ASP.Net application to scope components? I
know that forms and the like are set to a request scoping and that is
fine, but there are certain components I need to have a global scope and
some a session scope.

Nov 18 '05 #2
Are you saying I have to put the objects there? I cannot configure them to be
session scoped and have then created when a session starts?

Girish bharadwaj wrote:
Um.. You can use the Session, Application or Cache for that.

--
Girish Bharadwaj
http://msmvps.com/gbvb
"No One" <no***@yahoo.com> wrote in message
news:41***************@yahoo.com...
Is there any mechanism in an ASP.Net application to scope components? I
know that forms and the like are set to a request scoping and that is
fine, but there are certain components I need to have a global scope and
some a session scope.


Nov 18 '05 #3
Hi Girish,
Are you saying I have to put the objects there? I cannot configure them to be session scoped and have then created when a session starts?
When we're talking about scope, we're talking about memory (for the most
part - Session data can also be stored in a database, but must be
serializable in order to do so). Every Application has memory. In this case,
we're talking about a web server application, which is the memory space used
by ASP.Net for each web application defined in IIS. The application memory
space is where everything in the application's memory is stored. This
includes Application State, which is a Collection, Application Cache, which
is another Collection, and Session State, which is another Collection. Note
that all of these exist in the same "scope" which is the application memory
space of the app, which is global to the application. Session is not a
scope, but a Collection. Therefore, you can add and remove objects from the
Collection, but you can certainly not define them as having "Session Scope."

So, you could certainly create an instance of a class and store it in
Session when the Session starts, by using the global Session_OnStart event
handler.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"No One" <no***@yahoo.com> wrote in message
news:41***************@yahoo.com... Are you saying I have to put the objects there? I cannot configure them to be session scoped and have then created when a session starts?

Girish bharadwaj wrote:
Um.. You can use the Session, Application or Cache for that.

--
Girish Bharadwaj
http://msmvps.com/gbvb
"No One" <no***@yahoo.com> wrote in message
news:41***************@yahoo.com...
Is there any mechanism in an ASP.Net application to scope components? I know that forms and the like are set to a request scoping and that is
fine, but there are certain components I need to have a global scope and some a session scope.

Nov 18 '05 #4
One thing I should add, as Session is rather tricky: You could certainly
talk and think about an object being scoped to "Session Scope" as Sessions
are compartmentalized, and are indeed not visible to each other. While the
Session object is kept in Application memory (or in a database), it is
compartmentalized into separate Collections, one per client Session. This
makes Session scope a little confusing, and I'm not sure I've explained it
well enough.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"No One" <no***@yahoo.com> wrote in message
news:41***************@yahoo.com...
Are you saying I have to put the objects there? I cannot configure them to be session scoped and have then created when a session starts?

Girish bharadwaj wrote:
Um.. You can use the Session, Application or Cache for that.

--
Girish Bharadwaj
http://msmvps.com/gbvb
"No One" <no***@yahoo.com> wrote in message
news:41***************@yahoo.com...
Is there any mechanism in an ASP.Net application to scope components? I know that forms and the like are set to a request scoping and that is
fine, but there are certain components I need to have a global scope and some a session scope.

Nov 18 '05 #5

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

Similar topics

8
by: Ian McMeans | last post by:
I was bitten by a bug today that depended on how lambda works. It took me quite a while to realize what was going on. First, I made multiple lambda functions inside a loop, each of which...
2
by: David Stockwell | last post by:
Hi, Another of my crazy questions. I'm just in the process of learning so bear with me if you can. I actually ran it.... with two test cases TEST CASE 1: Say I have the following defined:...
2
by: Robert M. Gary | last post by:
I'm curious what the ANSI C++ standard says about nested classes. I'm not able to find where in the ANSI C++ standard this is addressed. The issue is the accessibility of sibling nested classes....
1
by: Michael | last post by:
I am having a problem with scoping of parameters in my XSLT Stylesheet...here is the stylesheet (the xml document is irrelevant for the example) <?xml version="1.0" encoding="UTF-8"?>...
4
by: Joel Gordon | last post by:
Hi, When I try and compile the a class containing the following method : public void doSomething() { for (int i=0; i<5; i++) { IList list = new ArrayList(); Console.WriteLine( i /...
9
by: NevilleDNZ | last post by:
Can anyone explain why "begin B: 123" prints, but 456 doesn't? $ /usr/bin/python2.3 x1x2.py begin A: Pre B: 123 456 begin B: 123 Traceback (most recent call last): File "x1x2.py", line 13,...
3
by: morris.slutsky | last post by:
So every now and then I like to mess around with hobby projects - I often end up trying to write an OpenGL video game. My last attempt aborted due to the difficulty of automating game elements and...
17
by: Chad | last post by:
The following question stems from Static vs Dynamic scoping article in wikipedia. http://en.wikipedia.org/wiki/Scope_(programming)#Static_versus_dynamic_scoping Using this sites example, if I...
3
by: SPECTACULAR | last post by:
Hi all. I have a question here.. what kind of scoping does C++ use? and what kind does Smalltalk use? I know smalltalk is a little bit old .. but any help would be appreciated.
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:
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: 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
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,...
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
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.