Solved

How to save HTML after Redirect into variable

Posted on 2008-11-01
8
261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 4

Expert Comment

by:justin-clarke
ID: 22857448
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
ID: 22857517
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
ID: 22859130
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tuckandroll
ID: 22859412
I'm receiveing the error:

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

when it reaches the line 4 (objXMLHTTP.Send)
0
 
LVL 12

Expert Comment

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

Expert Comment

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

Author Comment

by:tuckandroll
ID: 22878168
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
ID: 22912727
Using HTTPRequests to the Same Server is not recommended
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q316451
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

751 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