static vs appsession

R

rodchar

hey all,

if i wanted to instantiate my business class just once is there a difference
between making a static variable out of it and putting it in say application
session?

thanks,
rodchar
 
H

Hans Kesting

rodchar laid this down on his screen :
hey all,

if i wanted to instantiate my business class just once is there a difference
between making a static variable out of it and putting it in say application
session?

thanks,
rodchar

Yes, a very big difference:
A static variable would be shared by all users of your site.
A Session variable would be visible to a single session only (and other
sessions would have other instances of it)

Hans Kesting
 
G

Gregory A. Beamer

hey all,

if i wanted to instantiate my business class just once is there a
difference between making a static variable out of it and putting it
in say application session?

thanks,
rodchar

Session or Application?

The difference here is Session is per user, Application is for all
users.

A static class is essentially the same for both, unless you share a
single process for multiple apps, in which case it is possible to have
an object across multiple sites with a static class. Otherwise, they are
functionally the same.

The perf over static versus storing in application is similar. You might
end up with a small amount of overhead with a Application object, but
you can still use static methods, properties, etc when storing in
application.

If you mean the Session object, static will not work.

Peace and Grace,
 
G

Gregory A. Beamer

rodchar laid this down on his screen :

Yes, a very big difference:
A static variable would be shared by all users of your site.
A Session variable would be visible to a single session only (and
other sessions would have other instances of it)

Hans Kesting

I think the OP means the Application object, not Session object.

peace and grace,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top