473,802 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's the current wisdom on storing objects in the Application Variable?

In classic ASP, it was considered a bad idea to store VB6-created
objects in the Application variable for various threading issues.

What's the current wisdom on storing objects in the Application variable
in ASP.NET?

I am thinking of storing several objects there, not too large, so there
won't be any memory issues or anything like that. Is ASP.NET still
subject to threading issues?

Thanks.
Nov 18 '05 #1
4 2001
any shared objects do need to worry bout threading... so make it thread
safe...
use lock / mutexs etc to make it thread safe..

and application isnt the best place to store any data.. instead try using
cache object
cache object is smart... you can set the priority and you can set absolute /
sliding expiry times.. you can set callbacks if the object is unloaded...
and most important... cache removes object if its overloaded... and the way
it removes it is based on priority set by you..

application on the other hand would cause a restart if overloaded with data.

--
Regards,

HD

"Frank Rizzo" <no**@none.co m> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
In classic ASP, it was considered a bad idea to store VB6-created
objects in the Application variable for various threading issues.

What's the current wisdom on storing objects in the Application variable
in ASP.NET?

I am thinking of storing several objects there, not too large, so there
won't be any memory issues or anything like that. Is ASP.NET still
subject to threading issues?

Thanks.

Nov 18 '05 #2
couple of links to help you

creating multi threaded object in c#
http://msdn.microsoft.com/library/de...ithvisualc.asp

cache object
http://msdn.microsoft.com/library/de...classtopic.asp

--
Regards,

HD

"Hermit Dave" <he************ @CAPS.AND.DOTS. hotmail.com> wrote in message
news:ee******** ******@TK2MSFTN GP10.phx.gbl...
any shared objects do need to worry bout threading... so make it thread
safe...
use lock / mutexs etc to make it thread safe..

and application isnt the best place to store any data.. instead try using
cache object
cache object is smart... you can set the priority and you can set absolute / sliding expiry times.. you can set callbacks if the object is unloaded...
and most important... cache removes object if its overloaded... and the way it removes it is based on priority set by you..

application on the other hand would cause a restart if overloaded with data.
--
Regards,

HD

"Frank Rizzo" <no**@none.co m> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
In classic ASP, it was considered a bad idea to store VB6-created
objects in the Application variable for various threading issues.

What's the current wisdom on storing objects in the Application variable
in ASP.NET?

I am thinking of storing several objects there, not too large, so there
won't be any memory issues or anything like that. Is ASP.NET still
subject to threading issues?

Thanks.


Nov 18 '05 #3
Hi Frank:

You can keep a .NET object in Application state, but you do need to be
careful to avoid concurrent access and bottlenecks.

If the objects are not frequently used - consider the Cache object
instead. 'Frequently' is a relative term of couse...

It would still be a bad idea to store VB6 objects in Application state
in ASP.NET, as they need to run in a single threaded apartment - but I
don't think that was what you were asking.

--
Scott
http://www.OdeToCode.com

On Tue, 13 Jan 2004 12:15:37 -0800, Frank Rizzo <no**@none.co m> wrote:
In classic ASP, it was considered a bad idea to store VB6-created
objects in the Application variable for various threading issues.

What's the current wisdom on storing objects in the Application variable
in ASP.NET?

I am thinking of storing several objects there, not too large, so there
won't be any memory issues or anything like that. Is ASP.NET still
subject to threading issues?

Thanks.


Nov 18 '05 #4
Scott Allen wrote:
Hi Frank:

You can keep a .NET object in Application state, but you do need to be
careful to avoid concurrent access and bottlenecks.
I want to store read-only objects that would be loaded in the beginning
of the app via global.asax. This would have things like lookup lists,
connection string, etc...things that would not change for the duration
of the application. Given that the data is read-only, would I still
have to worry about concurrent access?

Given this information, do I still need to use the Cache object?


If the objects are not frequently used - consider the Cache object
instead. 'Frequently' is a relative term of couse...

It would still be a bad idea to store VB6 objects in Application state
in ASP.NET, as they need to run in a single threaded apartment - but I
don't think that was what you were asking.

--
Scott
http://www.OdeToCode.com

On Tue, 13 Jan 2004 12:15:37 -0800, Frank Rizzo <no**@none.co m> wrote:

In classic ASP, it was considered a bad idea to store VB6-created
objects in the Application variable for various threading issues.

What's the current wisdom on storing objects in the Application variable
in ASP.NET?

I am thinking of storing several objects there, not too large, so there
won't be any memory issues or anything like that. Is ASP.NET still
subject to threading issues?

Thanks.


Nov 18 '05 #5

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

Similar topics

1
2072
by: Liza | last post by:
Hi guys, can anyone explain line number 5 to me. i don't quite understand what is going on there and why. 1 <script language="vbscript" runat="server">sub Application_OnStart 2 getcustomers 3 end subsub getcustomers 4 set conn=Server.CreateObject("ADODB.Connection")
6
2582
by: Alfonso Morra | last post by:
I have written the following code, to test the concept of storing objects in a vector. I encounter two run time errors: 1). myClass gets destructed when pushed onto the vector 2). Prog throws a "SEGV" when run (presumably - attempt to delete deleted memory. Please take a look and see if you can notice any mistakes I'm making. Basically, I want to store classes of my objects in a vector. I also have three further questions:
4
1468
by: hufel | last post by:
Hi, I'm doing my first big project in C# and I'm stuck with a problem that I believe has a simple and efficient solution for it (I just haven't bumped into it yet...). The concept is the following: //Users manage clients. When the system creates the client it must fetch the information from the DB and allow some modifications: Client client = new Client("test"); MasterAccount ma = new MasterAccount(1324651);
0
1882
by: Namratha Shah \(Nasha\) | last post by:
Hey Group, After a long week end I am back again. Its nice and refreshing after a short vacation so lets get started with .NET once again. Today we will discuss about Isolated Storage. This is one of the topics which I find interesting as I feel that it has a lot of practical usage or applicability. We all know that all applications need some storage space to archive certain
0
1108
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 the error: QueryInterface for interface object.class failed I am able to create new instances of the object with no problems but as soon as I cast the session variable to the object like so: CType(Session("object"),object.class)
14
1615
by: rsine | last post by:
I did a recent post about what the standard was for naming a string builder object. My concern was that I did not what to use "str" prefix since this is used for strings but did not know what to use in its place. A few responses I received indicated such prefixing is no longer necessary in .Net and should be abandoned. Is this the correct approach? I am striving hard to make sure I use best practices in my code. -Thanks
2
1415
by: kito | last post by:
Hi, I wanted to get some advices from you guys. I have a little web-shop in ASP.NET for a project. I have several VB classes, where the most important ones are the "DBmanager" and the "DataManager". The DBManager creates the database connection and has some useful functions. The DataManager has an Object of the DBManager and uses that functions to get the Data as DataView, DataReader,.... Now to avoid that every time a user accesses...
10
2113
by: Franky | last post by:
I think I misread a post and understood that if I do: System.Windows.Forms.Cursor.Current = Cursors.WaitCursor there is no need to reset the cursor to Default. So I made all the reset statements into comments (placed an ' in front)
2
2818
by: teo | last post by:
I need to use the 'Session_End' event in the 'Global.asax' file. It only works if in the 'Web.config' file the 'sessionState mode' Tag is present and its value is set to "InProc" 1) I thought it was a default setting, wasn't it?
0
9699
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10536
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...
0
10304
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10285
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
10063
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
9114
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...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2966
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.