I came across this excellent looking tool Flesk ViewState Optimizer but was not able to find any details or documentation on it. Apparently the tool used to be commercial but now its free! I was able to dig up some history on it
Flesk.ViewStateOptimizer is a unique technology that overrides sending ViewState object to your client’s browser! This means that your client’s browser will no longer receive those large hidden field values, which thus reducing downloading time. Instead, Flesk.ViewStateOptimizer saves the page’s Viewstate hidden field to a file, on the server side, speeding up processing time, downloading time and data.
Combining Flesk.ViewStateOptimizer and Flesk.Accelerator,
you can benefit from reducing downloading data and downloading time up to 30 times faster! No other components
do the same or give the same results!
Flesk.Accelerator and Flesk.ViewStateOptimizer are now released with versions
targeted for the .NET Framework v2.0
How it works?
Flesk.ViewStateOptimizer has several viewstate optimization possibilities that can be set through the web.config file.
From viewstate data compression to saving viewstate on server farms, anything can be possible. This means that Flesk.ViewStateOptimizer can persist values using server side Sessions or files saved on shared locaton accessible by a server farm, or by using common viewstate hidden field value on client side, with the ability to compress data.
There are 2 ways to setup Flesk.ViewStateOptimizer on your web application or .Net project:
- In all your codebehind, instead of inheriting your class with
System.Web.UI.Page, change the inheritance to Flesk.Accelerator.Page.
If you use script block codebehind, use the following lines:
&amp;lt;%@ Page Language=&amp;quot;C#&amp;quot; Inherits=&amp;quot;Flesk.Accelerator.Page&amp;quot; %&amp;gt;
Flesk.ViewStateOptimizer is designed to meet the requirements of customers that are unable to change
the base class of their pages.
As such, Flesk.ViewStateOptimizer provides static methods that allows calling the viewstate procedures
from within any page class.
If you have access to the source of your base class, just add the following lines to the code:
protected override void SavePageStateToPersistenceMedium(object viewStateBag)
protected override object LoadPageStateFromPersistenceMedium()
If you are using precompiled code you’ll have to edit your aspx files. If at all possible, add the following
snippet to your aspx file:
protected override PageStatePersister PageStatePersister
Flesk.ViewStateOptimizer can use different storage methods:
Other parameters are:
- depending on the storage method setting, Flesk.ViewStateOptimizer can be set to compress viewstate value,
so that it can be significantly smaller than the original value
- the request behaviour of viewstate can be set to be generated on the first request to a page and then
reused in the following postbacks, or to be generated on each request to a page.
A common scenario where viewstate set to be generated on each request can be usefull is in Content Management
page loads up some controls on postback based on some state stored in hidden input values, handles events
and as a result of those actions purges the control collection and loads new controls.
Standard Flesk.ViewStateOptimizer configuration persists the Viewstate using the same GUID as the original
If the user then hit’s refresh (F5) in the browser, the data is posted again, the framework loads up it’s
controls based on the original state but the viewstate value now matches the new controls. This also happens
with any change to the viewstate between postbacks, when users back up or use refresh in their browsers.
The solution was to make Flesk.ViewStateOptimizer generate GUID’s each and every time the viewstate is persisted.
Only then is the viewstate truly unique for each page.
- Reduces downloading time of your website or web application, by not sending back the page’s Viewstate
- This component is setup individually. It is not shared by all the webserver’s websites, but only by
your website or webapplication. This means that you can install it in your hosting account without changing
any webserver’s configuration.
- Runs on .NET Framework v1.1 and v2.0. No configuration required. Only a few lines on your web.config
file is all you need to change.
- Greatly reduces bandwidth traffic from your webserver, reduces Posted data from your client’s browser,
and speeds up your web application!
Supported by WebFarms
Not sure what happened to the company but glad they decided to give their product for free now! (GPL license)
Edit Aug 12, 2010
To use this, here is what you put in Web.Config between and
The StorageMethod parameter sets the ViewState's storage type.
Possible values are :
- File (saves ViewState into a file, server side)
- StoragePath must specify a write enabled server path ( ~ means site root path)
If StoragePath is a web path (i.e.: \\MachineName\Dir), when used in webfarms,
please add the following line under &amp;lt;system.web&amp;gt;
&amp;lt;identity impersonate=&amp;quot;true&amp;quot; userName=&amp;quot;domain\username&amp;quot; password=&amp;quot;userpass&amp;quot;/&amp;gt;
- Default (default ViewState saving method, sending hidden fields to client side)
- Session (saves ViewState into a Session variable, server side)
- SqlServer (saves the ViewState into a database table)
- ConnectionString specifies the database connection.
- TableName specifies the table in the database where the records will be stored.
New Option :
Compressed=&amp;quot;true&amp;quot; or Compressed=&amp;quot;false&amp;quot;
this will compress the ViewState if StorageMethod is Default or File.
so the ViewState's value will be significantly smaller than the original value.
Compression method is not suported by StorageMethod=&amp;quot;Session&amp;quot;
Between and put the following:
&amp;lt;section name=&amp;quot;ViewStateOptimizer&amp;quot; type=&amp;quot;Flesk.Accelerator.Viewstate.ConfigHandler, Flesk.ViewState&amp;quot; /&amp;gt;
Between and you can put
This HttpModule provides automatic cleanup of viewstate files
on the start of each session, thus requiring
the SessionStateModule to be installed as well.
&amp;lt;add name=&amp;quot;ViewstateCleanupModule&amp;quot; type=&amp;quot;Flesk.Accelerator.Viewstate.CleanupModule, Flesk.ViewState&amp;quot;/&amp;gt;