the viewstate hidden field, how can I reduce it?

J

Jeff

hi

asp.net 3.5

I see in my page that the hidden field viewstate is relativly very large,
and are looking for ways to reduce it. Because I think it can improve
ranking.

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="WJ6eLjF5Grnr80+KngeZIcTDmEbX+zjv6ptIUmMgYaqKCBB/5hAKJ748W52U1l74GfNLHDuTLuwC/O4GQE/Sp+BnQYsW+nJHK+Qkg6xfb467kHRpiCUUl/Uv2tgQssSa2K4sfbMyaL/IIlb03091A3lbQV1wLMDvL7NPqXgwJERA1+Cx2eNlzll2WkbhNQw5Ne0FmtmBXaZysPeDEeQIrl5R2IesEHnCbrG5Mz2otNviv2JKia1yXgAKw3ljDlH7wmYWOF+WXn9lhsF5YElQnMZV2hpzQjJ91O5YARub/ci77gftNaI2Z6FqHjHve8Yai83aUS/RvXBK/MuDAr0x5QzCldkzBQyqv4FwbUqkP+e5F7Oo/307JM0mj6aBKZHmGzN4bT5cE/G/rOkNP7OrXrL0L/ht8yDOd43WyBuHIxYM3LNKSYimoNnaYKaXFBEmubIsoxpM/gxrEPNonVUozExBOTWIomfAQc5Z8zyeyphehA4iv9GVloZQhEZWPa29kvwvw1TqXpn9SySEFNikJWyCzTn1CcN8L33zAFJl3NOLW08yHtEG8r0NgDSE1I3ks0/AIzEIMCpgMfcsWytxwQ=="
/>
</div>

I've already set enableviewstate to false in the master page. This page
(deafult.apsx) has a 3 custom controls: one is control holding the login
control etc. The 2 other controls are based on gridview and loginview

any suggestions?
 
M

Mr. Arnold

Jeff said:
hi

asp.net 3.5

I see in my page that the hidden field viewstate is relativly very large,
and are looking for ways to reduce it. Because I think it can improve
ranking.

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="WJ6eLjF5Grnr80+KngeZIcTDmEbX+zjv6ptIUmMgYaqKCBB/5hAKJ748W52U1l74GfNLHDuTLuwC/O4GQE/Sp+BnQYsW+nJHK+Qkg6xfb467kHRpiCUUl/Uv2tgQssSa2K4sfbMyaL/IIlb03091A3lbQV1wLMDvL7NPqXgwJERA1+Cx2eNlzll2WkbhNQw5Ne0FmtmBXaZysPeDEeQIrl5R2IesEHnCbrG5Mz2otNviv2JKia1yXgAKw3ljDlH7wmYWOF+WXn9lhsF5YElQnMZV2hpzQjJ91O5YARub/ci77gftNaI2Z6FqHjHve8Yai83aUS/RvXBK/MuDAr0x5QzCldkzBQyqv4FwbUqkP+e5F7Oo/307JM0mj6aBKZHmGzN4bT5cE/G/rOkNP7OrXrL0L/ht8yDOd43WyBuHIxYM3LNKSYimoNnaYKaXFBEmubIsoxpM/gxrEPNonVUozExBOTWIomfAQc5Z8zyeyphehA4iv9GVloZQhEZWPa29kvwvw1TqXpn9SySEFNikJWyCzTn1CcN8L33zAFJl3NOLW08yHtEG8r0NgDSE1I3ks0/AIzEIMCpgMfcsWytxwQ=="
/>
</div>

I've already set enableviewstate to false in the master page. This page
(deafult.apsx) has a 3 custom controls: one is control holding the login
control etc. The 2 other controls are based on gridview and loginview

any suggestions?

You keep the data in session variables, load the controls from the
session variables, and disable viewstate on the controls.

I don't know what you mean about ranking, but disabling viewstate is
about not transmitting data for a control on the round trip, which
speeds up transmition time of the page.
 
J

Jason Keats

Jeff said:
hi

asp.net 3.5

I see in my page that the hidden field viewstate is relativly very large,
and are looking for ways to reduce it. Because I think it can improve
ranking.

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="WJ6eLjF5Grnr80+KngeZIcTDmEbX+zjv6ptIUmMgYaqKCBB/5hAKJ748W52U1l74GfNLHDuTLuwC/O4GQE/Sp+BnQYsW+nJHK+Qkg6xfb467kHRpiCUUl/Uv2tgQssSa2K4sfbMyaL/IIlb03091A3lbQV1wLMDvL7NPqXgwJERA1+Cx2eNlzll2WkbhNQw5Ne0FmtmBXaZysPeDEeQIrl5R2IesEHnCbrG5Mz2otNviv2JKia1yXgAKw3ljDlH7wmYWOF+WXn9lhsF5YElQnMZV2hpzQjJ91O5YARub/ci77gftNaI2Z6FqHjHve8Yai83aUS/RvXBK/MuDAr0x5QzCldkzBQyqv4FwbUqkP+e5F7Oo/307JM0mj6aBKZHmGzN4bT5cE/G/rOkNP7OrXrL0L/ht8yDOd43WyBuHIxYM3LNKSYimoNnaYKaXFBEmubIsoxpM/gxrEPNonVUozExBOTWIomfAQc5Z8zyeyphehA4iv9GVloZQhEZWPa29kvwvw1TqXpn9SySEFNikJWyCzTn1CcN8L33zAFJl3NOLW08yHtEG8r0NgDSE1I3ks0/AIzEIMCpgMfcsWytxwQ=="
/>
</div>

I've already set enableviewstate to false in the master page. This page
(deafult.apsx) has a 3 custom controls: one is control holding the login
control etc. The 2 other controls are based on gridview and loginview

any suggestions?

You can store viewstate on the server - for instance, in a database.

Here's a few search results, in no particular order...

http://forums.asp.net/p/1293397/2504654.aspx

http://geekswithblogs.net/joelross/archive/2006/03/23/73180.aspx

http://www.componentworkshop.com/blog/2009/06/27/advanced-net-storing-viewstate-in-a-database

http://www.codeproject.com/KB/viewstate/ViewStateProvider.aspx

http://weblogs.asp.net/adweigert/archive/2004/03/09/86628.aspx

http://highoncoding.com/Articles/699_Storing_ViewState_in_MongoDb_Database.aspx

HTH
 
J

Jeff

how do I disable viewstate? I've already set enableviewstate to false in the
master page and on the 3 custom controls. Depsite that I see the hidden
field viewstate in the source containing over 600 characters.
 
M

Mr. Arnold

Jeff said:
how do I disable viewstate? I've already set enableviewstate to false in the
master page and on the 3 custom controls. Depsite that I see the hidden
field viewstate in the source containing over 600 characters.


Just because something was done on a master page does that mean that it
applies to all pages.
 
J

Jeff

I applied the enableviewstate="false" to the page as well but still get that
hidden viewstate field

I know it's part of the asp.net design and cannot be completely removed from
the pages. But hope it's possible to reduce it from about 600 chars to under
100.....
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,060
Latest member
BuyKetozenseACV

Latest Threads

Top