0

Hy,

Let's say that I have class Node with some parameters Node[] child's, string id, string content ...
This class is like a another storage for data from mssql database.
And that web-application is running on IIS server and is written in ASP.NET C#

Now when one user open that page, certain data is dumped from db into that instance Node class depends on which sub-page user open.
And then another user open the same page and the same sub-page .. but again the same data is dumped into another instance of class Node.

What I want is to share that Node class between users, is that possible, so one user open the page and if no instance of Node class is made, new one is created, otherwise the same Node class is used and I'll use much, much less memory with the application :}

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Ramesh S
0

When a asp.net web page is accessed remotely by a user, IIS process the request and sends the output to the user. For processing the request, it may create some temprory variables based on the program logic that you have written. The temprory memory data will be cleared by .NET CLR once the response is sent to the client browser.

IIS will not store any data in memory unless you store data specific to users in Session. If you want to save memory, do not store values in Session, Application and Cache objects.

If you want to share the instance of a class in .NET, you need to implement Single Desig Pattern.

Check the following links.
Implementing Singleton in C#

Singleton Design Pattern

Implementing the Singleton Pattern in C#

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.