Instead of directly writing a response, you can simply add controls to the page. Since the page is brand new and free of markup, you may need to add all the HTML elements to make it legal HTML in order to get it right. Without trying this, I have no idea if this will work.
Page myPage = new Page(); page.Controls.Add( new LiteralControl( "hello " + pageName ) ); return myPage;
Itβs not clear to me that this will have the necessary HTML, HEAD and BODY tags. Perhaps it would be better to create a basic page with skeleton markup, with which you can simply add your controls and use the BuildManager, as in the example to create an instance of this page, and then add your controls.
tvanfosson
source share