468,321 Members | 1,809 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,321 developers. It's quick & easy.

Handling shared classes in multiple sessions

Don
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 have shared members.
How do I set it up so that each individual session uses a different "copy"
of each shared class? Right now, every session seems to share the same
shared variables (like a connection to a database, for example) inside the
shared class, but I don't want this. I guess, in a sense, all sessions are
sharing the same executing program when what I really want is for each
session to run its own copy of the program. I want each session to have its
own values for shared variables.

Can this be done?

- Don
Nov 18 '05 #1
2 1405
Then do not use a Shared class.
Remove the key word Shared form all properties and methods.

Be sure to add a New constructor.

Then you just create an instance of the class in the app and each user will
have their own copy.
--
Joe Fallon

"Don" <un*****@oblivion.com> wrote in message
news:1DN_b.609090$X%5.236342@pd7tw2no...
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 have shared members. How do I set it up so that each individual session uses a different "copy"
of each shared class? Right now, every session seems to share the same
shared variables (like a connection to a database, for example) inside the
shared class, but I don't want this. I guess, in a sense, all sessions are sharing the same executing program when what I really want is for each
session to run its own copy of the program. I want each session to have its own values for shared variables.

Can this be done?

- Don

Nov 18 '05 #2
Don
So, it's impossible to reduce the scope of shared properties from
application level to session level?

- Don
"Joe Fallon" <jf******@nospamtwcny.rr.com> wrote in message
news:uC****************@TK2MSFTNGP09.phx.gbl...
Then do not use a Shared class.
Remove the key word Shared form all properties and methods.

Be sure to add a New constructor.

Then you just create an instance of the class in the app and each user will have their own copy.
--
Joe Fallon

"Don" <un*****@oblivion.com> wrote in message
news:1DN_b.609090$X%5.236342@pd7tw2no...
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 have shared

members.
How do I set it up so that each individual session uses a different "copy" of each shared class? Right now, every session seems to share the same
shared variables (like a connection to a database, for example) inside the shared class, but I don't want this. I guess, in a sense, all sessions

are
sharing the same executing program when what I really want is for each
session to run its own copy of the program. I want each session to have

its
own values for shared variables.

Can this be done?

- Don


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by john | last post: by
5 posts views Thread by Rahul Anand | last post: by
3 posts views Thread by Ford Prefect alias Armin | last post: by
4 posts views Thread by Shankar Reddy | last post: by
15 posts views Thread by Rob Nicholson | last post: by
9 posts views Thread by viz | last post: by
9 posts views Thread by Josh | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.