<p>I need to grab the <code>base64-encoded</code> representation of the <code>ViewState</code>. Obviously, this would not be available until fairly late in the request lifecycle, which is OK.</p>

<p>For example, if the output of the page includes:</p>

<pre><code>&lt;input type="hidden" name="__VIEWSTATE" 
  id="__VIEWSTATE" value="/wEPDwUJODU0Njc5MD...==" /&gt;
</code></pre>

<p>I need a way on the server-side to get the value <code>"/wEPDwUJODU0Njc5MD...=="</code></p>

<p>To clarify, I need this value when the page is being rendered, not on PostBack. e.g. I need to know the ViewState value that is being <em>sent</em> to the client, not the ViewState I'm getting back from them.</p>

Rex, I suspect a good place to start looking is solutions that
compress the ViewState
-- they're grabbing ViewState on the server before it's sent down to the client and gzipping it. That's exactly where you want to be.
Scott Hanselman on ViewState Compression
(2005)
ViewState Compression with System.IO.Compression
(2007)