Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

How to save HTML after Redirect into variable

Hello family,
I have a classic ASP application that redirects from one page to another. A.asp > B.asp
The code within the A.asp page is Response.Redirect("B.asp").
My question is how do I dump ONLY the HTML markup used to create A.asp into B.asp. Basically, I want to capture the HTML into a variable within B.asp so I can later recreate the A.asp page at a later time.

For example, I want to be able to use Response.Write() to recreate the A.asp page.
Below is code inside B.asp page

*******
Dim varPageA as String

Set varPageA = "HTML content from A.asp"

Response.Write(varPageA)

*******

Thanks and don't forget to vote Nov 4th!
0
tuckandroll
Asked:
tuckandroll
  • 4
  • 3
1 Solution
 
justin-clarkeCommented:
you need to use a session variable.

So Set Session("HTMLContent") = varPageA

then you can read it as Set varPageA = Session("HTMLContent")

0
 
tuckandrollAuthor Commented:
Thanks, but I need to know how to derive the output for varPageA using using the HTTPRequest object. I only used varPageA for purposes of brevity and illustration. The only thing I know is that it has to eventually be of String type.
0
 
R_HarrisonCommented:
So on page B use the code below, it will call page A and save it as Session("PAGEA")

Then later you can response.write(Session("PAGE")) to redisplay the page.
URL="http://yourwebsite/pagea.asp"
	Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
	objXMLHTTP.Open "GET", URL, false
	objXMLHTTP.Send
	ReturnedData=objXMLHTTP.responseText
	Set objXMLHTTP = Nothing
	Session("PAGEA")=ReturnedData

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
tuckandrollAuthor Commented:
I'm receiveing the error:

msxml3.dll (0x800C0005)
The system cannot locate the resource specified.

when it reaches the line 4 (objXMLHTTP.Send)
0
 
R_HarrisonCommented:
Try re-registering the MSXML3.DLL on your server.
0
 
R_HarrisonCommented:
Click Start.
Choose Run.
In the Run box, type:
regsvr32 MSXML3.DLL
Press okay
0
 
tuckandrollAuthor Commented:
I tried both suggestion but to no avail.

Family, I think the issue is that the SEND command doesn't like it when I try to access an asp page from within my project (or the same web server). The above-code works fine when I point to a url from a remote server (i.e. "http://www.google.com/"). When I try to use it to access a page in my own web server, it complains. Hope this helps.
0
 
tuckandrollAuthor Commented:
Using HTTPRequests to the Same Server is not recommended
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q316451
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now