Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Can I include an ASP page in my ASPX page?


Message #1 by delcyan@w... on Tue, 12 Nov 2002 17:21:07
The .js file is downloaded by your /browser/...just like your browser
downloads all your images specified in <img src="...">

This is different to being able to "grab" an ASP page. An ASP page contains
script that needs to be interpreted. It may contain sensitive data (such as
database connection strings). As such, you usually can't get the ASP source
code from another server (or indeed, anywhere outside your web root). You
can, using a control that simulates a browser's GET request, get the
*output* of an ASP page (since this is just HTML...)

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Anthony Delcy" <DELCYAN@w...>
Subject: [aspx_professional] RE: Can I include an ASP page in my ASPX page?


Phil,

How come I can include a javascript file from another server but not an ASP
page? The following code works fine.

<script LANGUAGE="JavaScript1.2"
SRC="http://myIntranet.com/Include/footer.js"></script>

Is there a way then to get a javascript page on that different server to
include my ASP page?

Example: footer.js is on that other server, then in that footer.js is there
a way to include Index_en.asp and then I will include

<script LANGUAGE="JavaScript1.2"
SRC="http://myIntranet.com/Include/footer.js"></script>

in my aspx page.


Thank you

Anthony

>>> PhilipS@t... 11/12/02 12:34 >>>
For security reasons, many servers are configured not to allow you to copy
in
files located outside your webspace, or DocumentRoot.

This is why

<!--#include file="http://wyIntranet/applications/Includes/Index_en.asp"-->

won't work.

but having a .asp page included will work locally, provided your ASP code is
compliant
with the .NET framework, for example

include.aspx - has the following code:

<%@ Page Language="VB" debug="true" %>
<html>
<body>
<!--#include file="test.asp"-->
</body>
</html>

and test.asp has the following code:
<%
Response.Write("Hello World!")
%>

this works OK but if you change the Page language in include.aspx to "C#" it
will throw
a punctuation "; required" error.

The example works fine because it's fairly basic but as soon as you start
using any of the ASP
objects in depth, ie Session, Server.CreateObject, you're entering a whole
world of hurt
and it's going to be better to re-write in .NET.

Phil


-----Original Message-----
From: delcyan@w... [mailto:delcyan@w...]
Sent: 12 November 2002 17:21
To: ASPX_Professional
Subject: [aspx_professional] Can I include an ASP page in my ASPX page?


Hello,

I have developed an ASPX page and I would like to include and ASP page
from my Intranet into that APSX page to simulate the home page of our
Intranet and I only got it to work if the Intranet home page is on the
same server.

Really what I want is to include a file a file from a different server as
the following example:

<!--#include file="http://wyIntranet/applications/Includes/Index_en.asp"-->

The only time it works is if I do the following:

<!--#include file="Includes/Index_en.asp"-->

Can someone please get a hand here as of what I am doing wrong.

Thank you

Anthony






  Return to Index