Partager via


Visual Basic Concepts

State Management in IIS Applications

Typically, Internet applications are stateless, in that the protocol that passes requests and responses between the browser and Web server is not capable of maintaining  information between each request. Therefore, the protocol does not "remember" any information from previous requests when it receives a new request.

Because the protocol itself cannot maintain state, you must use other means to store information you want the application to remember between requests. There are several ways you can store state for a Web-based application:

Note   You can use a combination of these methods. For example, you might store information in a database and use cookies to send the database keys to the client.

Each approach has its own advantages and disadvantages. Storing state in objects is easy, but it may affect the scalability of your applications because the server must keep the object instantiated across requests and locate the same object each time it makes a subsequent request. Using databases is more scalable, but requires you to manage connections and recordsets. Moving state back and forth between client and server allows you to avoid storing information in either location but does increase the bandwidth of each request, has capacity limitations, and is potentially less secure.