advertisement
Login | Register   
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   TIP BANK
Browse DevX
Download the code for this article
The author has shown several techniques you can use to maintain state in ASP.NET applications. Can you think of other ways to maintain state? Do you use Viewstate in your Web Forms? Did you know how it worked? Let us know in the web.asp.plus discussion group.
Partners & Affiliates
advertisement
advertisement
advertisement
advertisement
 

ASP.NET Simplifies State Management in Web Applications

If you're tired of writing state management code in your Web applications, you'll be happy to know that ASP.NET not only greatly simplifies the process, but also solves some of the classic ASP Session object's problems, such as using Sessions with Web farms, and persisting state data. 


advertisement
ne of ASP.NET's main improvements over classic ASP is its improved options for state management. Die-hard ASP classic developers moving to ASP.NET are often surprised by the dramatic change in programming paradigm. The powerful state management techniques in ASP.NET make Web development much more like traditional Windows desktop programming. This article shows you how to use the various techniques for managing state in ASP.NET and the pitfalls of each method.


Managing State the ASP.NET Way
The simple application shown in Figure 1 illustrates how ASP.NET manages state:

Figure 1: The application retains the text in the label between postbacks to the server.
The dropdown list and the button shown in Figure 1 are part of an HTML form. When the user clicks the Submit button, the browser posts the form back to the server. Forms in ASP.NET (aspx) pages post back to the originating page by default. The server-side code takes the item the user selected and uses it to create the text of a Label control on the Web page that shows the item selected. ASP.NET's automatic state management preserves the text in the Label control between postbacks as well as the user's selection in the Listbox. You don't have to write any extra code to make the items retain state between postbacks.

It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com.
Already a member?



advertisement