This is a mirror of official site: http://jasper-net.blogspot.com/

ViewState: Various ways to reduce performance overhead

| Monday, August 23, 2010
Table of Contents
  • Introduction
  • What is viewstate
  • Problems with ViewState
  • Compressing and Decompressing ViewState
  • Points to Remember
  • Saving viewState on server
  • Using Session
  • Removing ViewState file from server
  • Points to Remember
  • Using Hidden field
  • Removing ViewState file from server
  • Conclusion
  • Feedback and Suggestions
  • History
Introduction:

In this Article, I am going to explore the View State. View state is one thing that always I liked to use. It makes our life easier. As we all know that Viewstate is one way of maintaining the states in the web applications.

As we know, a web page is created every time when a page is posted to the server.It means The values that user entered in the webpage is going to be vanished after the postback or submit. To get rid of this problem, ASP.NET framework provides a way to maintain these values by virtue of View State. When we enable the viewstate of any control, the value is going to be maintained on every postbacks or server roundtrips.

But how these values get maintained? It doesn't come free.View State uses hidden variable that resides on the page to store the controls values. It means that if a page have lots of controls with viewstate enabled the page size would become heavy, in several of kilobytes ie it will take longer time to download.And also on every postback all the data is posted to the server i e increasing the network traffic as well.

As in new era application, we use lots of heavy controls like gridview etc, on our page which makes page size exponentially heavy.It is always recommended to use View State judiciously and even some programmers try to avoid using this cause of performance overhead.

Here , I am going to discuss how we can reduce the performance overhead caused by View State.

What is View State:

As we know Web is stateless medium ie states are not maintained between the requests by default.A web page is created every time when a page is posted to the server.

Read more: Codeproject

Posted via email from .NET Info

0 comments: