Strategies for reducing ViewState size in asp.net

后端 未结 6 1612
星月不相逢
星月不相逢 2021-01-12 18:17

I use \'n\' number of server controls in my page. Now I am into performance tuning and I\'ve noticed that my ViewState is too large and it makes my page slow.<

6条回答
  •  清歌不尽
    2021-01-12 18:56

    Add the following code to the page which generates large viewstate values. Alternatively, this can be added to master page to eliminate the need of adding on each page. The below code allows the viewstate to be stored in session.

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

提交回复
热议问题