Solved

How to save HTML after Redirect into variable

Posted on 2008-11-01
8
257 Views
Last Modified: 2012-05-05
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
Comment
Question by:tuckandroll
  • 4
  • 3
8 Comments
 
LVL 4

Expert Comment

by:justin-clarke
Comment Utility
you need to use a session variable.

So Set Session("HTMLContent") = varPageA

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

0
 

Author Comment

by:tuckandroll
Comment Utility
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
 
LVL 12

Accepted Solution

by:
R_Harrison earned 50 total points
Comment Utility
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
 

Author Comment

by:tuckandroll
Comment Utility
I'm receiveing the error:

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

when it reaches the line 4 (objXMLHTTP.Send)
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 12

Expert Comment

by:R_Harrison
Comment Utility
Try re-registering the MSXML3.DLL on your server.
0
 
LVL 12

Expert Comment

by:R_Harrison
Comment Utility
Click Start.
Choose Run.
In the Run box, type:
regsvr32 MSXML3.DLL
Press okay
0
 

Author Comment

by:tuckandroll
Comment Utility
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
 

Author Comment

by:tuckandroll
Comment Utility
Using HTTPRequests to the Same Server is not recommended
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q316451
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now