Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing generated HTML

Status
Not open for further replies.

Glasgow

IS-IT--Management
Jul 30, 2001
1,669
GB
As ASP generates its HTML to render in a browser, is there any way of capturing that final HTML so that, for example, a copy of the information displayed can be inserted into an email that is essentially a dump of the page presented to the end user?

I hope that makes sense!

Thanks in advance.
 
Hiya

I have some code using JMail/XMLhttp which does this exact thing

Code:
dim objXMLHTTP 
set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP") 
objXMLHTTP.Open "GET","[URL unfurl="true"]http://www.mysite.com/myhtmlpage.html,[/URL] false 
objXMLHTTP.SetRequestHeader "Content-type", "text/html" 
objXMLHTTP.Send
Dim strMsg : strMsg = objXMLHTTP.ResponseText
Dim msg
set msg = Server.CreateOBject( "JMail.Message" )
msg.Logging = true
msg.silent = false
msg.From = "me@mysite.com"		
msg.AddRecipient "myemailrecipient@mysite.com"
msg.Subject = "Email Subject"
msg.HTMLBody = cstr(strMsg)
msg.Send("mymailserver")

hope this is of some use

Nick (Webmaster)

 
I've had a go but I don't think this is what I need. I want to capture the precise HTML about to be or just rendered to the user's browser - this could include data entered by that user which has been stored in session variables and re-displayed in the appropriate fields.

I have a feeling that using this mechanism will effectively return HTML as if it were a separate session - so none of the variables I have stored are available.

Any thoughts?
 
Hmm yes i see what you mean.
I didn't have that problem in my code as I recorded the specific information to a database, and then called the page with a specific ID to recall the information for that user. Perhaps this might work for your project?

Failing that, anyone got any other ideas?

Nick (Webmaster)

 
Thanks for your replies, Nick.

The theory appears to be confirmed when I insert a
Response.Write Session.SessionId in the page

- i.e. it shows a different session in the original page from the HTML generated by the XMLHTTP call. So close but so far!

I can't use a database to retrieve the data but there are alternatives available to me. It just turns it into a somewhat larger job!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top