473,405 Members | 2,160 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,405 software developers and data experts.

Session scope

Hi.

I've constructed a class in the singleton model, like this:
class MyClass
{
private MyClass instance;

public MyClass GetInstance()
{
if (this.instance == null)
this.instance = new MyClass();

return this.instance;
}

private MyClass () { ... }
}
It seems that in ASP.NET my instance belongs to the application, because
each session gets the same instance.
What to do in order to each session has its own instance?

Thanks,
Eduardo
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.525 / Virus Database: 322 - Release Date: 09/10/2003
Nov 17 '05 #1
1 1264
in asp.net, page requests are handled by a thread pool of app, so any
sington is shared across all threads. also asp.net change which thread is
processing a single page request at its whim (thread agile). this mean if
you want global data tied to a page request you have to inhert from
ContextBoundObject

-- bruce (sqlwork.com)

"Eduardo Pavinato Klein" <ed**********@nospam.no> wrote in message
news:#U**************@TK2MSFTNGP11.phx.gbl...
Hi.

I've constructed a class in the singleton model, like this:
class MyClass
{
private MyClass instance;

public MyClass GetInstance()
{
if (this.instance == null)
this.instance = new MyClass();

return this.instance;
}

private MyClass () { ... }
}
It seems that in ASP.NET my instance belongs to the application, because
each session gets the same instance.
What to do in order to each session has its own instance?

Thanks,
Eduardo
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.525 / Virus Database: 322 - Release Date: 09/10/2003

Nov 17 '05 #2

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

Similar topics

8
by: Lichunlin | last post by:
Dear all, Sorry for cross posting. I have one page, create an object and save it in session scope, and then redirect to another page.In the new page, the object existed in session object, but...
3
by: Simon Niederberger | last post by:
How can I give a user-defined object session scope? From http://www.microsoft.com/windows2000/en/server/iis/default.asp?url=/windows2000/en/server/iis/htm/asp/iiwaobu.htm I gather that it can...
7
by: Nicole | last post by:
Hi I'm trying to use a function to set a session variable. I have three files: The first file has: <?php session_start(); // This connects to the existing session ?> <html> <head>
4
by: Dean | last post by:
I finally got class session variables to work by putting the following in global.asax in the session_start: dim myDBComp as DBComp = new DBComp........ session("myDBComp") = myDBComp In each...
4
by: Elliot M. Rodriguez | last post by:
I am seeking some advice on an issue I am facing concerning session state. I have an app that relies on 2 session values being set at the start. These session values set the stage for data that...
8
by: Dave Wurtz | last post by:
All, I'm new to ASP development and I have a basic design question: Is it ok to store business objects to session variables or is there a better way to keep object information? For example,...
15
by: SFX | last post by:
If I have a session ID (string) can I somehow obtain the session object associated to that ID (it exist of course) ? I know this sounds wicked but I have a situation in which I have to make a...
0
by: HL | last post by:
Hi, I have a small application that authenticates the user and stores the credentials and other identity info in a session-scope object. After browsing a few pages, that session-scope object...
18
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
6
by: Bhagya | last post by:
Hello, On the LogOut Page i have done Session.Abandon(); And on every Page, In the Page_Load Event i check if the session exists and only then display data. Now the problem is after i logout from...
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: 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
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
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
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.