Save ViewState to server - deserialize is very slow

Discussion in 'ASP .Net' started by mohaaron@gmail.com, Apr 25, 2006.

  1. Guest

    Can anyone tell me why when trying to use the following code to
    deserialize the viewstate it takes a long time with a large viewstate.
    This really surprised as the viewstate is big, but not that big. The
    formatter.Deserialize method takes a couple seconds which is a long
    time.

    protected override object LoadPageStateFromPersistenceMedium()
    {
    object viewState;
    string tempViewState;
    tempViewState = (string)this.Cache["ViewState"];
    LosFormatter formatter = new LosFormatter();
    try
    {
    viewState = formatter.Deserialize(tempViewState);
    }
    catch(Exception x)
    {
    throw new HttpException ("Invalid viewstate:" + x.ToString());
    }
    return viewState;
    }
    , Apr 25, 2006
    #1
    1. Advertising

  2. What are you storing in there, and what is the goal? Here's an article,
    which also references some excellent work by Robert Boedigheimer, that covers
    all this:

    http://www.eggheadcafe.com/articles/20040613.asp

    Peter



    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "" wrote:

    > Can anyone tell me why when trying to use the following code to
    > deserialize the viewstate it takes a long time with a large viewstate.
    > This really surprised as the viewstate is big, but not that big. The
    > formatter.Deserialize method takes a couple seconds which is a long
    > time.
    >
    > protected override object LoadPageStateFromPersistenceMedium()
    > {
    > object viewState;
    > string tempViewState;
    > tempViewState = (string)this.Cache["ViewState"];
    > LosFormatter formatter = new LosFormatter();
    > try
    > {
    > viewState = formatter.Deserialize(tempViewState);
    > }
    > catch(Exception x)
    > {
    > throw new HttpException ("Invalid viewstate:" + x.ToString());
    > }
    > return viewState;
    > }
    >
    >
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Apr 25, 2006
    #2
    1. Advertising

  3. Guest

    Peter,

    Thanks for the reply. I have seen this article and currently have my
    solution working in a similer way. I am still wondering why the
    Deserialize method is soo slow with a large viewstate. I would expect
    that this would be handled a lot better.
    , Apr 25, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Earl Teigrob
    Replies:
    7
    Views:
    419
    Scott M.
    Feb 16, 2004
  2. Replies:
    3
    Views:
    623
  3. moonhk
    Replies:
    4
    Views:
    706
  4. Alf P. Steinbach /Usenet

    Slow -- VERY slow brain

    Alf P. Steinbach /Usenet, Jun 16, 2011, in forum: C++
    Replies:
    17
    Views:
    497
    Noah Roberts
    Jun 29, 2011
  5. Nick Green
    Replies:
    4
    Views:
    180
    Nick Green
    Nov 18, 2009
Loading...

Share This Page