Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

IIS ASP: How to display another web page within an .asp page

Posted on 2007-11-16
18
Medium Priority
?
915 Views
Last Modified: 2010-04-21
I have a URL (on the same site, with several GET parameters), that needs to be displayed in the middle of another page.

in PHP i would do it with readfile or require
<?php readfile("http://xxx.com/list.pl"); ?>

i know very little about IIS and ASP, so exact syntax would be helpful.

many thanks
0
Comment
Question by:willsherwood
[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
  • 7
  • 6
  • 2
  • +1
18 Comments
 
LVL 15

Assisted Solution

by:spprivate
spprivate earned 400 total points
ID: 20300739
can u be more specific please.Normally to show two webpages in a single page we use frames.
Is that what you are looking for
0
 

Author Comment

by:willsherwood
ID: 20301010
sorry i want to use an include or require type of feature, not frames.
the example i have works fine in PHP on Apache using readfile(... URL )

0
 
LVL 15

Assisted Solution

by:spprivate
spprivate earned 400 total points
ID: 20301080
Normally I use
<!-- #include file="../../menu.asp" -->

to include a page in another asp.
This should work
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 

Author Comment

by:willsherwood
ID: 20301159
the above appears to be a filesystem path.
is there a way to include an http protocol URL?
0
 
LVL 20

Assisted Solution

by:jitganguly
jitganguly earned 200 total points
ID: 20301261
How do I read the contents of a remote web page?    
You can include static txt and HTML files from remote servers by using a component (such as AspHTTP (http://www.serverobjects.com/products.htm), ASPTear (http://www.alphasierrapapa.com/ComponentCenter/AspTear/), or VB's built in InetCtrls) to parse the remote URL's content.
 
You can also try this method out, it uses the MSXML objects which are installed with Windows 2000 (or you can download them here (http://download.microsoft.com/download/xml/Install/3.0/WIN98Me/EN-US/msxml3.exe) for other operating systems):
 
<%
    url = "http://www.espn.com/
    set xmlhttp = server.CreateObject("Microsoft.XMLHTTP")
    xmlhttp.open "GET", url, false
    xmlhttp.send "" 
    Response.write xmlhttp.responseText
%>

use fso to write to a file, you need to set proper permissions on the server to create and write to a file (give the IUSR_webservername write permissions in the directory targetted)

<%

' create the fso object

set fso = Server.Createobject("Scripting.FileSystemObject")

path = "c:\temp\test.txt"

strDate = Replace(Date(), "/", "")

strDir = "c:\inetpub\wwwroot\articles\" & strDate

strNewFileName = Hour(Now) & "_" & Minute(Now) & "_" & second(Now) & ".html"



' open the old file

set file = fso.opentextfile(path, 1)  <-- For reading

strText = file.readall

set file = nothing



' check for and/or create folder

if not fso.folderexists(Server.MapPath(strDir)) then

     set f = fso.CreateFolder(Server.MapPath(strDir))

else

     set f = fso.GetFolder(Server.MapPath(strDir))

end if



' create and write new file

set file = fso.Createtextfile(f.path & "\" & strNewFileName)

file.write(strText)

set f = nothing

file.close

set file = nothing



' delete the old file

fso.DeleteFile(path & "\" & rst("FileName") & i)



' clean up

set fso = nothing

%>

also check these links for more:
http://www.4guysfromrolla.com/webtech/090599-1.shtml
http://www.15seconds.com/Issue/000816.htm
http://msdn.microsoft.com/library/devprods/vs6/vbasic/vbenlr98/vaobjfilesystemobject.htm
0
 
LVL 10

Expert Comment

by:effx
ID: 20303893
Try (may work):

<script type="text/javascript" language="javascript">
function ajaxFunction(pagetoget, element_name){
//By EFFXDesign.com
var xmlHttp;
      try{xmlHttp=new XMLHttpRequest();}    // Firefox, Opera 8.0+, Safari
      catch (e){    // Internet Explorer
            try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
            catch (e){
                  try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
                  catch (e){
                        alert("Your browser does not support AJAX!");
                        return false;
                  }
            }
      }
    xmlHttp.onreadystatechange=function(){
            if(xmlHttp.readyState==4){
                  document.getElementById(element_name).innerHTML=xmlHttp.responseText;
            }
      }
    xmlHttp.open("GET",pagetoget,false);
    xmlHttp.send(null);
}
</script>
<div id="op">Loading Page....</div>

<script type="text/javascript" language="javascript">
ajaxFunction('http://www.yahoo.com/', 'op');
</script>
0
 
LVL 10

Expert Comment

by:effx
ID: 20303906
<%
domain = "http://www.effxdesign.com/"
path_to_files = ""
page_to_get = domain & path_to_files
browser_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)"' 'setting browser type
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
      objHttp.open "POST", page_to_get, false
      objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
      objHttp.setRequestHeader "USERAGENT", browser_agent
      objHttp.setRequestHeader "RETURNTRANSFER", 1
      objHttp.setRequestHeader "SSL_VERIFYPEER", false
      objHttp.setRequestHeader "SSL_VERIFYHOST", 0
      objHttp.Send str
      page_result = objHttp.responseText
set objHttp = Nothing
page_result = replace(page_result, "=""/", "=""" & domain & "")
Response.Write(page_result)
%>
0
 
LVL 10

Expert Comment

by:effx
ID: 20303911
the reason i split the domain and the path is so that wil can re write the paths on the page loaded from the other site.

the Replace statement actually replaces all the:

/

with

http://www.effxdesign.com/

this gives the correct output display.
0
 

Author Comment

by:willsherwood
ID: 20313116
it worked fine.
we're very happy
thanks
0
 

Author Comment

by:willsherwood
ID: 20313203
i spoke too soon.
the effx script displas successfullyy the results of the root URL without applying the GET parameters.

the actual statement below is:

<%domain = "http://xxx.edu/axs/ax-admin.pl?maximum=&format=Sort+All+by+Time&s11=CHECKED&MakeGraphs=View+in+Graphical+Format&start_date=&end_date=&Filter="

what are we doing wrong to have it ignore the GET parameters

thanks for your continued patience

0
 
LVL 10

Expert Comment

by:effx
ID: 20313815
Did you use the ASP or the Javascript ?
0
 
LVL 10

Accepted Solution

by:
effx earned 1400 total points
ID: 20313829
:-)
<%
domain = "http://xxx.edu/"
path_to_files = "axs/ax-admin.pl?maximum=&format=Sort+All+by+Time&s11=CHECKED&MakeGraphs=View+in+Graphical+Format&start_date=&end_date=&Filter="
%>

Open in new window

0
 

Author Comment

by:willsherwood
ID: 20315160
EXCELLENT!  
0
 
LVL 10

Expert Comment

by:effx
ID: 20322814
So I wrote the coed and got no points ?
0
 
LVL 10

Expert Comment

by:effx
ID: 20322830
This sort of thing makes me think what a waste of time experts exchange is.
0
 

Author Closing Comment

by:willsherwood
ID: 31409624
this (new) scoring was my original intent, not sure what went wrong?
i was very pleased, and sorry for the mishap, certainly no hidden agenda or ill-intent!   you guys are great.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Logparser is the smartest tool I have ever used in parsing IIS log files and there are many interesting things I wanted to share with everyone one of the  real-world  scenario from my current project. Let's get started with  scenario - How do w…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

722 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