Click here to Skip to main content
15,890,670 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Any one suggest me

Why view state is designed as client side state management technique?

i think http is the state less protocal,when postbaks happens controls losses its state.mostly all controls maintaining view state to maintain state.

for this reason view state is designed as client side state management technique.

am i correct?

can we maintain server side also write?

i heared that there is a way to access the view state data from one form to other form?(by default its not possible) is there any way?

Thank u
Posted
Updated 24-Jul-13 9:19am
v2

Viewstate

Viewstate is a hidden fields in an ASP.NET page, contains state of those controls on a page whose “EnableViewstate” property is “true”.

You can also explicitly add values in it, on an ASP.NET page like:

Viewstate.Add( “TotalStudents”, “87″ );

Viewstate should be used when you want to save a value between different roundtrips of a single page as viewstate of a page is not accessible by another page.

Because Viewstate renders with the page, it consumes bandwidth, so be careful to use it in applications to be run on low bandwidth.

View state is stored on client side ( HTML page in hidden fields ) not on server.

i heared that there is a way to access the view state data from one form to other form?(by default its not possible) is there any way?


Yea there is a way,you can store view state in session by using

XML
<configuration>
    <system.web>
        <browserCaps>
            <case>RequiresControlStateInSession=true</case>
        </browserCaps>
    </system.web>
</configuration>


Or on Page

C#
protected override PageStatePersister PageStatePersister
{
    get
    {
        return new SessionPageStatePersister(this);
    }
}


Note : For more information: ASP.NET Client Side State Management - ViewSta[^]
 
Share this answer
 
You understand something correct and i also want to add lil bit.There are so many advantage of client side state management. As per as the view state is concerned,its advantages are

1) No server resources are required : The view state is contained in a structure within the page code.

2) Simple implementation : View state does not require any custom programming to use. It is on by default to maintain state data on controls.

3) Enhanced security features : The values in view state are hashed, compressed, and encoded for Unicode implementations, which provides more security than using hidden fields.

4) Implementation : It is based on the wish of developer that they want to implement it at the page level or at control level.

As usual there are some disadvantages also like,

1) Performance considerations : Because the view state is stored in the page itself, storing large values can cause the page to slow down when users display it and when they post it. This is especially relevant for mobile devices, where bandwidth is often a limitation.

2) Device limitations : Mobile devices might not have the memory capacity to store a large amount of view-state data.

3) Potential security risks : The view state is stored in one or more hidden fields on the page. Although view state stores data in a hashed format, it can still be tampered with. The information in the hidden field can be seen if the page output source is viewed directly, creating a potential security issue.

So,how to and where to use it depends on so many parameters which should be decided based on

- How secure you want your data to be stored?

- How much data is there that needs to be stored?

Regards..:laugh:
 
Share this answer
 
v2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900