Basically I want to capture the .aspx file as is
Because you state "capture the ASPX", I'm assuming the data edits are persisted somewhere (memory/database). This means it is straightforward to override the Render() method of the control/page and redirect (or copy) the output stream to a file.
Example
protected override void Render( HtmlTextWriter writer ) { using( HtmlTextWriter htmlwriter = new HtmlTextWriter( new StringWriter() ) ) { base.Render( htmlwriter ); string renderedContent = htmlwriter.InnerWriter.ToString(); // do something here with the string, like save to disk File.WriteAllText( @"c:\temp\foo.html", renderedContent ); // you could also Response.BinaryWrite() the data to the client // so that it could be saved on the user's machine. // and/or write it out to the output stream as well writer.Write( renderedContent ); } }
Sequence
- User enters data
- You store the results somewhere
- You re-render the control with the most recent content
- Capture the output of the control and write it out to a file