473,406 Members | 2,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Inluding a file in ASP+

Hi I am very new to ASP+, i have a background in Coldfusion and ASP.

Anyway what i want to do is include a file set by a varianle so

apologies for the phsedo like code....
<%
dim myFileName
myFileName = 'pageToInclude.aspx'
%>

<html>
<body>
...
....
<%
include myFileName
%>

</body>
</html>
anyone know, or can point me in the direction of some useful tutorials

thankyou

Andrew
Nov 19 '05 #1
10 1065
This is <!--#include file="test.aspx"-->

That said it is condisered as legacy. In ASP.NET, it is likely better to use
a user control... (.ascx file)

Patrice

--

"Andrew Price" <an**********@fusionworkshop.com> a écrit dans le message de
news:Cj***************@newsfe1-win.ntli.net...
Hi I am very new to ASP+, i have a background in Coldfusion and ASP.

Anyway what i want to do is include a file set by a varianle so

apologies for the phsedo like code....
<%
dim myFileName
myFileName = 'pageToInclude.aspx'
%>

<html>
<body>
..
...
<%
include myFileName
%>

</body>
</html>
anyone know, or can point me in the direction of some useful tutorials

thankyou

Andrew

Nov 19 '05 #2
Andrew Price wrote:
<%
include myFileName
%>

You are pretty close. The include syntax is
<!--#include file="pageToInclude.aspx"-->

BTW: Fun to see the ASP+ was the name of ASP.NET at an early stage. This
is why the file extension is ASPX the X is a + sign rotated 45 degrees.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
Nov 19 '05 #3
On Tue, 01 Feb 2005 11:17:39 +0100, Anders Norås
<an**********@objectware.no> wrote:
Andrew Price wrote:
<%
include myFileName
%>

You are pretty close. The include syntax is
<!--#include file="pageToInclude.aspx"-->

BTW: Fun to see the ASP+ was the name of ASP.NET at an early stage. This
is why the file extension is ASPX the X is a + sign rotated 45 degrees.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/


Will that work programitically with the OPs variable, it certainly
wouldn't in ASP classic I don't think, though you could always
Server.Execute you way out of it if I recall correctly.

I

--
Iain Norman | http://www.eliteforum.org
Nov 19 '05 #4
but can the

<!--#include file="pageToInclude.aspx"-->

be a variable name

I got that far before in ASP I just wondereed if in ASP.NET they allowed you
to dynamically include a file, ie in Coldfusion it is possible to

<cfset myVariable = "pagename.cfm">

<cfinclude template="#myVariable#">

this would then include the name of the file defined in the variable, can
this be done

Andrew

PS. Thanks for explaining about ASP, ASPX, ASP+ and ASP.NET now i get it !!!
"Anders Norås" <an**********@objectware.no> wrote in message
news:OE**************@TK2MSFTNGP11.phx.gbl...
Andrew Price wrote:
<%
include myFileName
%>

You are pretty close. The include syntax is
<!--#include file="pageToInclude.aspx"-->

BTW: Fun to see the ASP+ was the name of ASP.NET at an early stage. This
is why the file extension is ASPX the X is a + sign rotated 45 degrees.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/

Nov 19 '05 #5
How do you mean ?
can you explain..
Andrew
"Patrice" <no****@nowhere.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
This is <!--#include file="test.aspx"-->

That said it is condisered as legacy. In ASP.NET, it is likely better to
use
a user control... (.ascx file)

Patrice

--

"Andrew Price" <an**********@fusionworkshop.com> a écrit dans le message
de
news:Cj***************@newsfe1-win.ntli.net...
Hi I am very new to ASP+, i have a background in Coldfusion and ASP.

Anyway what i want to do is include a file set by a varianle so

apologies for the phsedo like code....
<%
dim myFileName
myFileName = 'pageToInclude.aspx'
%>

<html>
<body>
..
...
<%
include myFileName
%>

</body>
</html>
anyone know, or can point me in the direction of some useful tutorials

thankyou

Andrew


Nov 19 '05 #6
It really depends on what you are after.

You could use :
- User controls (ASCX files). Basically this is a page fragment that can
include both HTML to define its appearence and code so that you can expose
functionality and behavoir to the hosting page
For details, see :
http://msdn.microsoft.com/library/de...ercontrols.asp

If this is to provide basic functionality on each page you could also either
hook the BeginRequest/EndRequest event or inheriting from a base page
providing common capabilities etc...

Go for include for a quick port but you may want to check other available
options if this is a new app...

Patrice

--

"Andrew Price" <an**********@fusionworkshop.com> a écrit dans le message de
news:cN*************@newsfe1-gui.ntli.net...
How do you mean ?
can you explain..
Andrew
"Patrice" <no****@nowhere.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
This is <!--#include file="test.aspx"-->

That said it is condisered as legacy. In ASP.NET, it is likely better to
use
a user control... (.ascx file)

Patrice

--

"Andrew Price" <an**********@fusionworkshop.com> a écrit dans le message
de
news:Cj***************@newsfe1-win.ntli.net...
Hi I am very new to ASP+, i have a background in Coldfusion and ASP.

Anyway what i want to do is include a file set by a varianle so

apologies for the phsedo like code....
<%
dim myFileName
myFileName = 'pageToInclude.aspx'
%>

<html>
<body>
..
...
<%
include myFileName
%>

</body>
</html>
anyone know, or can point me in the direction of some useful tutorials

thankyou

Andrew



Nov 19 '05 #7
Hi andrew,
but can the

<!--#include file="pageToInclude.aspx"-->

be a variable name
You really need to bone up on object-oriented programming. ASP is
procedural; ASP.Net is object-oriented. The question you're asking is
similar to asking "how do I double-clutch an automatic transmission?" The
answer is "you don't." You're working with objects, events, and
multi-threading now. The whole programming paradigm is different.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Andrew Price" <an**********@fusionworkshop.com> wrote in message
news:4N*************@newsfe1-gui.ntli.net... but can the

<!--#include file="pageToInclude.aspx"-->

be a variable name

I got that far before in ASP I just wondereed if in ASP.NET they allowed
you
to dynamically include a file, ie in Coldfusion it is possible to

<cfset myVariable = "pagename.cfm">

<cfinclude template="#myVariable#">

this would then include the name of the file defined in the variable, can
this be done

Andrew

PS. Thanks for explaining about ASP, ASPX, ASP+ and ASP.NET now i get it
!!!
"Anders Norås" <an**********@objectware.no> wrote in message
news:OE**************@TK2MSFTNGP11.phx.gbl...
Andrew Price wrote:
<%
include myFileName
%>

You are pretty close. The include syntax is
<!--#include file="pageToInclude.aspx"-->

BTW: Fun to see the ASP+ was the name of ASP.NET at an early stage. This
is why the file extension is ASPX the X is a + sign rotated 45 degrees.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/


Nov 19 '05 #8
Andrew Price wrote:
but can the include (abridged) be a variable name

No it cannot be a variable name. If you want to dynamically include
predefined "parts" in an ASPX page I suggest, as others have done before
me, you use user controls. User controls are contained in ASPX pages,
and offer Web developers an easy way to reuse commonly used Web UI.
User controls are similar to ASPX pages, but they have a different page
declaration and their extension is ASCX.
To get started creating user controls, read the tutorial at
http://www.asp101.com/lessons/usercontrols.asp

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
Nov 19 '05 #9
Thankyou for your help

Andrew
"Anders Norås" <an**********@objectware.no> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Andrew Price wrote:
but can the include (abridged) be a variable name

No it cannot be a variable name. If you want to dynamically include
predefined "parts" in an ASPX page I suggest, as others have done before
me, you use user controls. User controls are contained in ASPX pages, and
offer Web developers an easy way to reuse commonly used Web UI.
User controls are similar to ASPX pages, but they have a different page
declaration and their extension is ASCX.
To get started creating user controls, read the tutorial at
http://www.asp101.com/lessons/usercontrols.asp

Anders Norås
http://dotnetjunkies.com/weblog/anoras/

Nov 19 '05 #10
Thankyou for your help

Andrew
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:Ox*************@TK2MSFTNGP10.phx.gbl...
Hi andrew,
but can the

<!--#include file="pageToInclude.aspx"-->

be a variable name


You really need to bone up on object-oriented programming. ASP is
procedural; ASP.Net is object-oriented. The question you're asking is
similar to asking "how do I double-clutch an automatic transmission?" The
answer is "you don't." You're working with objects, events, and
multi-threading now. The whole programming paradigm is different.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

"Andrew Price" <an**********@fusionworkshop.com> wrote in message
news:4N*************@newsfe1-gui.ntli.net...
but can the

<!--#include file="pageToInclude.aspx"-->

be a variable name

I got that far before in ASP I just wondereed if in ASP.NET they allowed
you
to dynamically include a file, ie in Coldfusion it is possible to

<cfset myVariable = "pagename.cfm">

<cfinclude template="#myVariable#">

this would then include the name of the file defined in the variable, can
this be done

Andrew

PS. Thanks for explaining about ASP, ASPX, ASP+ and ASP.NET now i get it
!!!
"Anders Norås" <an**********@objectware.no> wrote in message
news:OE**************@TK2MSFTNGP11.phx.gbl...
Andrew Price wrote:
<%
include myFileName
%>
You are pretty close. The include syntax is
<!--#include file="pageToInclude.aspx"-->

BTW: Fun to see the ASP+ was the name of ASP.NET at an early stage. This
is why the file extension is ASPX the X is a + sign rotated 45 degrees.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/



Nov 19 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Brad | last post by:
Dear friends, I am working on a App. at my work place, now wanting to set it up at home but for some reason I keep getting this error : ADODB.Command (0x800A0BB9) Arguments are of the...
4
by: bienwell | last post by:
Hi, I'd like to do downloading big data from my table into a zip file in ASP.NET program (without displaying data on the datagrid control) by an event button_click . If you have your advises or...
3
by: Pavan Apuroop | last post by:
Hi All, I have developed one web site in ASP .Net 2.0 Beta 2 and published (deployed) the same in my local IIS. Now if i am trying to access the same site, then it is giving me an error as...
2
by: Andy Fish | last post by:
Hi, I have a single-file aspx file (no codebehind). when I try to do this: <%@ Import Namespace="MySql.Data.MySqlClient" %> I get this: CS0246: The type or namespace name 'MySql' could...
3
by: emman_54 | last post by:
Hi every one, I am trying to run a batch file using my asp.net application. I am using the Process class to run the batch file. When I run my web application, In the task manager, i could see...
3
by: Fredrik | last post by:
I want to generate a pdf file of "the current page". It is a ASP.NET aspx file created partly from GET parameters, but most often using the ASP.NET event model (i.e. clicking buttons etc). One...
10
by: vunet.us | last post by:
What is the workaround of passign a parameter to any included asp file: <!-- #Include File="file.asp" --> This obviously does not work: <!-- #Include File="file.asp?id=123" --> Thank you
1
by: armando | last post by:
Hi, I'm working on a web site devolepped in asp and this site work with the incusion in the page asp <td id="Colonna lato sinistro" width="200px" valign="top" style="height: 19px"> <!--#include...
3
by: TREVOR SILKSTONE | last post by:
I need to CONVERT file.ASP TO HTM or HTML
10
by: Ben | last post by:
Hi, i have a weird problem and i don't know who is responsible for this: IIS, excel or asp.net. My problem: we use an asp.net 2.0 application under IIS 6.0 (server 2003 sp2) which must write...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.