I am experimenting with dynamically creating pages containing custom
controls in response to http requests caught by an http handler, in
place of writing and requesting aspx files. Specifically, I am doing
the following:
- mapping requests to an http handler
- instantiating a class hierarchy that, retrieves data, parses the URL
and performs some business processing
- instantiating the Page class and adding controls
- rendering the page object to an HtmlTextWriter object
- Response.Write the contents of the HtmlTextWriter back to the
browser

At no point am I using or creating an .aspx file.

The reason why I am investigating doing things this way is that we are
trying to build a very flexible, customisable user interface on top of
a multi-layered data-driven system.

I am successfully rendering controls in this way. However, even though
the web controls explicitly set
EnableViewState = true;
the _VIEWSTATE hidden field is not being rendered to the browser.

The questions I have are:
How can I ensure that the the viewstate field is rendered along with
the control? and,
Is what I am attempting to do possible?

Thanks in advance