To provide a seamless and coherent user experience, Web-based applications must include a way of maintaining state. ASP.NET pages and Web Forms components can automatically maintain state and some Web Forms components offer properties and methods that let you manage this. Take into account the various advantages and disadvantages of each solution when choosing the method of maintaining state that will optimize the performance of your application.
As an ASP.NET developer, you can optimize the way your application maintains state by understanding the impact of several factors. You will want to handle state management differently depending on the amount of data, availability of the server, and the resources for implementation. You can have your application save data locally on the client (either to the View State, in a cookie, or in hidden form fields), or on the server (either to the Session State or Application State or to an SQL database). Depending on the amount of data, some approaches to saving state have more impact on the performance of the server and some have more on the client side.
The following table provides an overview of the state management options and features specific to each option.
Less Coding |
Large Data Sets |
Server Performance |
Client Performance |
Data Durability |
Scalability |
Security |
Data Integrity |
Data Accessible by other software |
Configuration options |
|
---|---|---|---|---|---|---|---|---|---|---|
View State |
X |
|
|
|
|
|
|
|
|
|
Session State |
|
X |
|
X |
X |
X |
|
|
||
SQL Database |
|
X |
X |
|
X |
X |
X |
X |
X |
X |
Page Request |
|
X |
X |
|
|
|
|
If you are unfamiliar with state management, first read the overview in State Overview.
In Spread for ASP.NET, you can manage state in different ways, including the following options:
- Saving Data to the View State, which is client based
- Saving Data to the Session State, which is server based
- Saving Data to an SQL Database, which is server based
- Loading Data for Each Page Request
These topics discuss the advantages and disadvantages of these options. Review this information to determine the best approach for your application.