Solved

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

Posted on 2007-11-16
18
907 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
  • 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

What is an ISAPI filter?   •      It's an assembly (.dll file) that can add or change the way IIS works.   •      They can be enabled globally for your web server or on a site-by-site basis.   When the IIS server receives a request, enabling the ISAPI fi…
Debug Tools to analyse IIS process: This article focus on taking memory dumps from IIS to determine which code is taking more time and to analyse which calls hangs/causes more CPU usage. To take dumps,download the following. Install1: To st…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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