Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
871 views
in Technique[技术] by (71.8m points)

asp.net - Where is ViewState stored?

Where is a ViewState Stored? Is it stored in Server or Client Side?

I have a huge data which should be stored for some process. I was using Session. But when moved from one page to another im not able to clear the session. So I thought of implementing ViewState. But when running with huge amount of data ViewState is throwing error?

How can I resolve this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Viewstate is stored on page it self in encoded form. You can't access the viewstate in client side in a direct manner. You need to know the encoding/decoding algorithms to fetch the valuable data from this viewstate in clientside code.

You can use hidden variable to store data that will be used only on that page. Hidden variables are accessible from client side and server side code.

You can use Cache or session to store datatable (large data). They will have good performance as compare to ViewState.

The Cache is always using the machine's memory, the Session uses what has been configured:

In a web farm the Session can be local (which works only if affinity is set), or remote (state server or database, or custom), but the cache is always local.

So, storing a DataTable in the cache will consume memory, but it will not use serialization.

PS: storing a DataSet instead of a DataTable will change almost nothing.

Refer Cache Implementation


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...