Groups | Blog | Home
all groups > inetserver asp components > november 2003 >

inetserver asp components : Grab HTML



David Taylor
11/23/2003 8:04:55 AM
I'm looking for a way to grab the HTML behind one of my pages and display it
to the user. The page I'm trying to get the HTML from is an ASP page, so
obviously I'm looking for the post-asp processing results. Basically I want
the same HTML that the user could get if they had done a "View Source" in
their browser on the page.

Does IIS/ASP provide a way to do this natively, or do I have to buy a third
party component?

TIA
David

Ray at <%=sLocation%
11/23/2003 12:40:45 PM
http://www.aspfaq.com/5003

Ray at home

[quoted text, click to view]

el.c. - myLittleTools.net
11/24/2003 11:39:44 AM
Hi

[quoted text, click to view]

You can do it using XMLHTTP component, which is a standard component in
IIS.

hth

--
// myLittleTools.net : leading provider of web-based applications.
// myLittleAdmin : online MS SQL manager
// http://www.mylittletools.net
// webmaster@mylittletools.net

learnhubremthisonly NO[at]SPAM singnet.com.sg
11/29/2003 4:37:42 PM
Use FileSystemObject



On Mon, 24 Nov 2003 11:39:44 +0100, "el.c. - myLittleTools.net"
[quoted text, click to view]
Roland Hall
12/11/2003 4:00:57 AM
[quoted text, click to view]

strURL is what you change and will display any text file. DO NOT pass
strURL as a variable because then anyone can read the source of all of your
ASP files. Also, test before you provide this to anyone. If it has a
connection to a SQL DB and had UID and PW in there, it will be displayed.

I make a separate file for each one I want to display. It is this file with
the strURL modified and I label it the same as the file with a prefix:
Ex. source_somefile.asp

<%@ Language=VBScript %>
<%
Dim strURL
strURL = "/somefolder/somefile.asp"
Dim strDir, strFileName
strDir = Request.ServerVariables("APPL_PHYSICAL_PATH")
strFileName = Replace(strURL,"/","\")
strFileName = strDir & strFileName

Const ForReading = 1
Dim objFSO, objTextStream
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTextStream = objFSO.OpenTextFile(strFileName, ForReading)

Response.Write "<HTML><BODY>"
Response.Write "<XMP>" & objTextStream.ReadAll & ""
Response.Write ""
objTextStream.Close
Set objTextStream = Nothing
Set objFSO = Nothing
%>

--
Roland

This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose.

AddThis Social Bookmark Button