Asp – a stateless class (in asp.net)

asp.netclass

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

Best Answer

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 stateful 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.