tags:

views:

420

answers:

1

What is a stateless class (in asp.net) ?

+5  A: 

The basic idea here is that your class only exists for the duration of the html request. After the request is processed, your class goes away.

State means that you "remember" things from one call to the next in class variables. Stateless means that you don't.

It is certainly possible to store a class in the session and have it around for every page, but I gather that is not the situation discussed in the book.

EDIT:

An example of a state**ful** class might be one that increments a "pages visited" counter each time a page is loaded. That would not work unless you persist your class in the session.

JR
Thanks JR. That makes sense
Glad I could help :-)
JR