Chapter 13. State
This chapter covers
Web applications are stateless by nature, which means that you don’t have a native way to handle state. If you’re familiar with desktop applications, you know that state plays a central role in a typical application. For example, you can save your users’ preferences and let them find their preferences again next time they use the application. Even though no native way exists to handle state as per the HTTP protocol, modern application frameworks (like ASP.NET) provide a lot of features in this area. Depending on your needs, you can manage state at different levels—on the client or on the server. Generally, state handling is performed server side, where the data is stored.
The objectives of handling state are disparate: you can store user settings or save frequently requested objects to avoid the cost associated with fetching them every time. The objects can be stored with a lifetime that varies, depending on the approach that you choose, but typically, you have a lot of possibilities.