capturing HTML of the same page during a postback

C

Carlos

Hi all,

I need to capture all the html that is generated after the user fills
all the controls on a page. This needs to be captured at the moment
the user hits the submit button. I tried doing it wit a server.execute, but
it raises an exception. It complains about 'infinite loop or infinite
recursion'
i.e.

Dim writer As StringWriter = New StringWriter()

Server.Execute("Default.aspx", writer)

Dim text As String = writer.ToStrin

Can someone suggest something else?

Thanks,



Carlos.
 
S

Scott M.

Couldn't you do this with client side JavaScript and a hidden form field?

<input type="hidden" id="pageHTML">
<input type="submit" onclick="pageHTML.value=document.documentElement">
 
P

PJ on Development

Hi, Carlos,

As Scott said, you can do it at the moment the user submits the form
by registering a onsubimit event handler.

However, the syntax is a little bit differend than Scott wrote:

function form_OnSubmit()
{
document.getElementById('hiddenFieldHtmlValue').value =
document.documentElement.outerHTML;
}

And that will work regardless what button is pressed, or how the page
is submitted.

Regards,

Paulo Santos
http://pjondevelopment.50webs.com
 
L

LVP

Just interested to know why you want this?
I am sure you have a good idea, can you share?

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top