> ## Content Index
> Fetch the complete content index at: https://blog.tsd.digital/llms.txt
> Use this file to discover other available public pages before exploring further.

# Quick ASP.Net tip: Half your page size in ASP.Net instantly
- URL: https://blog.tsd.digital/quick-aspnet-tip-half-your-page-size-in-aspnet-instantly/
- Published: 2009-04-17T13:53:05.000Z
- Updated: 2009-04-17T13:53:05.000Z
- Author: Tim Gaunt
- Tags: ASP.Net, C#, Development, .Net, The Site Doctor, #Import 2025-04-01 05:37

Ok it might be a little less than half side but it's near enough. I've been sitting on this for a while and needed to reference it for someone so I thought I'd post quickly about it. One of the most common complaints about .Net is that you have a lot of hidden "content" by the way of hidden inputs and the likes throughout your site. This can easily get corrupt on postback/slowdown the page load times etc.

Really you should be optimising each control on the page (enabling/disabling where relevant) but if you want to cheat (lets face it, we all do):

1. Download the files: [PageStateAdapterv1.0.zip (3KB)](http://blogs.thesitedoctor.co.uk/tim/files/PageStateAdapterv1.0.zip?ref=blog.tsd.digital)
2. Put PageStateAdapter.browser into your /App\_Browsers/ folder (or create one and add it)
3. Put TSDPageStateAdapter.dll into your website's /bin/ folder
4. Load up your website and checkout your ViewState :)

Incase you're interested in the source for it:

PageStateAdapter.browser<browsers><browser refID="Default"><controlAdapters><adapter controlType="System.Web.UI.Page" adapterType="TheSiteDoctor.PageStateAdapter.PageStateAdapter"/></controlAdapters><capabilities><capability name="requiresControlStateInSession" value="true"/></capabilities></browser></browsers>

PageStateAdapter.csusing System.Web.UI; namespace TheSiteDoctor.PageStateAdapter {...}{ public class PageStateAdapter : System.Web.UI.Adapters.PageAdapter {...} { public override PageStatePersister GetStatePersister() {...} { return new SessionPageStatePersister(this.Page); } }}

The best example of how much this reduces ViewState by is when you add a large DataGrid to your site.

Post files: [PageStateAdapterv1.0.zip (3KB)](http://blogs.thesitedoctor.co.uk/tim/files/PageStateAdapterv1.0.zip?ref=blog.tsd.digital)

**Update:** Apologies to those of you who downloaded and found it wouldn't compile, the .browser file was a little off (missing the second "PageStateAdapter"). I've updated it and changed the zip file download. Enjoy!