473,395 Members | 1,474 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.

About Shared properties in ASP.NET

Hi,
I'm using a custom class in my ASP.NET which has a Shared property.
I don't want this Shared property to be shared between users because of
thread concurrent accesses problems.
I just want it to be shared between the several instances of the class
belonging to the same request/user.
I think I've read somewhere that shared properties are not shared among
users in ASP.NET. (that would be logic as a shared property should die after
each user's request has ended)
So I think I don't have to use SyncLock inside this Shared property as each
client request is run completely separately and a thread from a request
won't access the same shared property as another request's thread.
Am I right?
Thanks for your answer.

Nov 19 '05 #1
1 1735
> I think I've read somewhere that shared properties are not shared among
users in ASP.NET. (that would be logic as a shared property should die
after
each user's request has ended)
Afraid not. Shared (static) objects are stored in the heap, and are
singletons (there is only one, no instance). The use of the syntax "shared"
is, IMHO, unfortunate, in that it is a little misleading. But what is
important is what it means. Instantiated objects are (copies of execution
code) placed on the stack, a volatile region of memory where instances are
placed while being used, and removed afterwards. Shared (static) objects
remain in the heap, a region of code into which the program execution code
is loaded (from the DLL) at startup.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Henri" <hm********@hotmail.com> wrote in message
news:ed*************@TK2MSFTNGP12.phx.gbl... Hi,
I'm using a custom class in my ASP.NET which has a Shared property.
I don't want this Shared property to be shared between users because of
thread concurrent accesses problems.
I just want it to be shared between the several instances of the class
belonging to the same request/user.
I think I've read somewhere that shared properties are not shared among
users in ASP.NET. (that would be logic as a shared property should die
after
each user's request has ended)
So I think I don't have to use SyncLock inside this Shared property as
each
client request is run completely separately and a thread from a request
won't access the same shared property as another request's thread.
Am I right?
Thanks for your answer.

Nov 19 '05 #2

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

Similar topics

10
by: John Brock | last post by:
I have a base class with several derived classes (I'm writing in VB.NET). I want each derived class to have a unique class ID (a String), and I want the derived classes to inherit from the base...
0
by: Shiraz | last post by:
Hi I have a question regarding the functionality of merge modules. Since this relates to my previous queries, I'll just give you a brief background on the topic. I had to make an installer for...
2
by: Don | last post by:
I'm asking this for a friend of mine, so forgive me if I'm getting some of the terminology wrong (I don't have any experience with ASP.NET). I've got an ASP application that has some classes that...
3
by: Chris Dunaway | last post by:
How can a class be shared between a web service and a client that consumes the web service? Suppose I have a Class Libraray with the following simple class: Public Class SimpleClass Private...
5
by: Simon | last post by:
Hi all, We have an ASP.NET 1.1 application running on IIS6 on Server 2003. Most of the base objects we are using in this application are taken from a windows application also written by us. We...
2
by: mgoold2002 | last post by:
Hello. I've just begun programming in VB .NET, and I'm trying to turn all my modules into classes. In order to retrieve/exchange values from one class to another, I initiated New instances of the...
8
by: Al | last post by:
I'd like to create Class Library in VB 2005, which has a property accessible by external programs. I decided to include 1 Class with 1 property in this project. I placed this code in Class:...
1
by: Tony Johansson | last post by:
Hello! If I select a private assembly in ILDASM I get a lot of information listed but if I select a shared assembly located at c:\window\assembly(GAC) I get nothing listed. So is this normal...
6
by: wingphil | last post by:
Hi there, I have a shared method in a base class, and I need to know which subclass it has been called from. So for example Public Mustinherit Class BaseClass Public Shared Sub SharedMethod...
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
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:
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.