Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8653735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:36:51+00:00 2026-06-12T14:36:51+00:00

I was reading this article from Microsoft about the state management. http://msdn.microsoft.com/en-us/library/75x4ha6s(v=vs.100).aspx I found

  • 0

I was reading this article from Microsoft about the state management.

http://msdn.microsoft.com/en-us/library/75x4ha6s(v=vs.100).aspx

I found an interesting thing here. ViewState is categorized as Client Side option (Although I already knew that). It reminds me of our code in the application.

DataTable dt = getDatatableFromDB();
ViewState["dataTable"] = dt;

And this code is working fine at the moment.

My confusion is :

  1. How can a client side object(ViewState) save Server side object(Datatable)?
  2. Is it a good practice to use ViewState for storing large objects like Datatables?
  3. What possibly could be the side effect(if any) if we keep on using this approach?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:36:53+00:00Added an answer on June 12, 2026 at 2:36 pm

    The viewstate is stored in a hidden <input /> tag on the form. When the user initiates a postback (by clicking a button, for example), the data is returned to the server as part of the form data.

    If you store large amounts of data in the ViewState, you will incur a penalty both when the user attempts to download the page (because all that data will be part of the HTML) and when the user attempts to submit the form (because all that data must be uploaded back to the server).

    In addition, the ViewState is easily lost. It is only preserved as long as the user is submitting the form. If the user clicks a hyperlink to another page, the form is never submitted and all the data contained within the ViewState is lost. This is true even if the anchor tag points back to the page the user is currently on.

    I see from your previous question that you are trying to find a good place to put your DataTables. ViewState is not the worst place as long as the data is relatively small. Base64 is better than XML in terms of memory usage but it is still a long way from efficient. If the data is fairly static, you may want to consider storing it in the ApplicationState. If you are editing the DataTable with a GridView, then the GridView is actually already storing the DataTable for you which you can access via the DataSource property (just cast it back to a DataTable).


    It is also worth noting that while the ViewState data is encoded in base64 (meaning the average user will not be able to understand it), it can be easily edited by a determined user. Seemingly innocuous data could be edited to become quite harmful to your website. This is a classic avenue for hacking a website, so you must be very careful about what data, exactly, you are storing. For example, if you store the user’s ID in the ViewState, the user could edit the ID and hack into another user’s account. (Note: this is only an issue if EnableViewStateMac has been set to False.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Reading through this MSDN article http://msdn.microsoft.com/en-us/library/dd460648.aspx I'm seeing a claim that MEF doesn't have
Reading this article Taking Advantage of High-Definition Mouse Movement - http://msdn.microsoft.com/en-us/library/windows/desktop/ee418864(v=vs.100).aspx , I surmise
After reading the MSDN article ( http://msdn.microsoft.com/en-us/magazine/2009.01.genevests.aspx ) on implementing a Custom STS using
I was reading about data driven testing using mbunit from this article. http://blog.benhall.me.uk/2007/04/mbunit-datafixture-data-driven-unit.html I
Reading this article http://support.microsoft.com/kb/813878 I have a question: Where can I get ipseccmd.exe for
I am trying to understand the 'SocketAsyncEventArgs' class in C#. http://msdn.microsoft.com/en-us/library/system.net.sockets.socketasynceventargs.aspx I am following
i am reading this article about saving trees into database http://www.dba-oracle.com/t_sql_patterns_trees.htm But i don't
After reading this article I don't have a clear answer: http://palizine.plynt.com/issues/2010Oct/bypass-xss-filters/ Will browsers interpret
I was reading this article on Coding Horror: http://www.codinghorror.com/blog/2008/04/setting-up-subversion-on-windows.html I went to the downloads
After reading this article http://camendesign.com/code/developpeurs_sans_frontieres I have decided to follow what it says and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.