Solved

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

Posted on 2007-11-16
18
913 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 100 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 100 total points
ID: 20301080
Normally I use
<!-- #include file="../../menu.asp" -->

to include a page in another asp.
This should work
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

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 50 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 350 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

Industry Leaders: 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!

Question has a verified solution.

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

First of all, clustering IIS is something you should rarely consider doing. In almost all cases, Microsoft Network Load Balancing (NLB) (http://technet.microsoft.com/en-us/library/cc758834(WS.10).aspx) is a much better solution when you need to p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

623 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