473,324 Members | 2,239 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,324 software developers and data experts.

ASP.NET Includes Text or HTML Files into ASPX pages

I'm trying to find out how to INCLUDE a file (text or html
etc) into my ASPX page.
I don't want to know how to create a user control etc just
a quick simple example.

Looking for something similar to the old fashioned ASP
include <!--#include file="time.inc"--> but a .NET version.

Jul 21 '05 #1
5 12181

"Bari" <ba****@hotmail.com> wrote in message
news:03****************************@phx.gbl...
I'm trying to find out how to INCLUDE a file (text or html
etc) into my ASPX page.
I don't want to know how to create a user control etc just
a quick simple example.

Looking for something similar to the old fashioned ASP
include <!--#include file="time.inc"--> but a .NET version.

Hmmm, UserControls ARE the .NET version of how this is done, yet you DON'T
want that?!

Could you tell me how to put 10 gallons of water into a 5 gallon bucket all
at once please?
Jul 21 '05 #2
Traditional #include is nit really a good option for the OO nature of
asp.net. The correct approach is to use user controls, but they can be very
simple to implement.

Add this line to the top of your aspx page
includeme.ascx is the equivalent of the old include file with your HTML
etc, in my case it is a navigation menu

<%@ Register TagPrefix="myProject" TagName="includedthing"
Src="includeme.ascx" %>

To position the include file in the page add the line below to you ASPX
page

<myProject:menu:includedthing ID="myfirstinclude" runat="server" />

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Bari" <ba****@hotmail.com> wrote in message
news:03****************************@phx.gbl...
I'm trying to find out how to INCLUDE a file (text or html
etc) into my ASPX page.
I don't want to know how to create a user control etc just
a quick simple example.

Looking for something similar to the old fashioned ASP
include <!--#include file="time.inc"--> but a .NET version.

Jul 21 '05 #3
Or better yet, in VS.NET, just drag the UserControl (.ascx file) on to the
host page at the desired location and you are done!
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Traditional #include is nit really a good option for the OO nature of
asp.net. The correct approach is to use user controls, but they can be very simple to implement.

Add this line to the top of your aspx page
includeme.ascx is the equivalent of the old include file with your HTML
etc, in my case it is a navigation menu

<%@ Register TagPrefix="myProject" TagName="includedthing"
Src="includeme.ascx" %>

To position the include file in the page add the line below to you ASPX
page

<myProject:menu:includedthing ID="myfirstinclude" runat="server" />

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Bari" <ba****@hotmail.com> wrote in message
news:03****************************@phx.gbl...
I'm trying to find out how to INCLUDE a file (text or html
etc) into my ASPX page.
I don't want to know how to create a user control etc just
a quick simple example.

Looking for something similar to the old fashioned ASP
include <!--#include file="time.inc"--> but a .NET version.


Jul 21 '05 #4
that would indeed do it in vs.net..........(old hardcore developers like me
like to do it the old fashioned way - notepad and the SDK )

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Scott M." <s-***@BADSPAMsnet.net> wrote in message
news:#Y**************@TK2MSFTNGP09.phx.gbl...
Or better yet, in VS.NET, just drag the UserControl (.ascx file) on to the
host page at the desired location and you are done!
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Traditional #include is nit really a good option for the OO nature of
asp.net. The correct approach is to use user controls, but they can be

very
simple to implement.

Add this line to the top of your aspx page
includeme.ascx is the equivalent of the old include file with your HTML
etc, in my case it is a navigation menu

<%@ Register TagPrefix="myProject" TagName="includedthing"
Src="includeme.ascx" %>

To position the include file in the page add the line below to you ASPX
page

<myProject:menu:includedthing ID="myfirstinclude" runat="server" />

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Bari" <ba****@hotmail.com> wrote in message
news:03****************************@phx.gbl...
I'm trying to find out how to INCLUDE a file (text or html
etc) into my ASPX page.
I don't want to know how to create a user control etc just
a quick simple example.

Looking for something similar to the old fashioned ASP
include <!--#include file="time.inc"--> but a .NET version.



Jul 21 '05 #5
I am also an "old hardcore", "Visual" Notepad using developer, but if I can
find a way for VS to generate the exact same (emphasis on "exact same") code
that I would have had to have written, I'll take it!
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
that would indeed do it in vs.net..........(old hardcore developers like me like to do it the old fashioned way - notepad and the SDK )

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Scott M." <s-***@BADSPAMsnet.net> wrote in message
news:#Y**************@TK2MSFTNGP09.phx.gbl...
Or better yet, in VS.NET, just drag the UserControl (.ascx file) on to the host page at the desired location and you are done!
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Traditional #include is nit really a good option for the OO nature of
asp.net. The correct approach is to use user controls, but they can be
very
simple to implement.

Add this line to the top of your aspx page
includeme.ascx is the equivalent of the old include file with your

HTML etc, in my case it is a navigation menu

<%@ Register TagPrefix="myProject" TagName="includedthing"
Src="includeme.ascx" %>

To position the include file in the page add the line below to you ASPX page

<myProject:menu:includedthing ID="myfirstinclude" runat="server" />

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Bari" <ba****@hotmail.com> wrote in message
news:03****************************@phx.gbl...
> I'm trying to find out how to INCLUDE a file (text or html
> etc) into my ASPX page.
> I don't want to know how to create a user control etc just
> a quick simple example.
>
> Looking for something similar to the old fashioned ASP
> include <!--#include file="time.inc"--> but a .NET version.
>



Jul 21 '05 #6

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

Similar topics

25
by: Martin Walke | last post by:
Hi, This may seem like a client side problem but.... I have web pages that are made up of a number of javascript include files as well as 'in page' script. They all work fine running locally...
12
by: tshad | last post by:
I am not sure why I am getting this error: I have the following code I want to run from another include file that holds all my functions. functions.inc...
6
by: William F. Zachmann | last post by:
We've got a project going that involves moving an old web site with a massive dll written in C++ that produces most of the output from a SQL 7.0 data base on NT4 onto IIS on Windows 2003 Server...
5
by: Bari | last post by:
I'm trying to find out how to INCLUDE a file (text or html etc) into my ASPX page. I don't want to know how to create a user control etc just a quick simple example. Looking for something...
1
by: stephan.j.bird | last post by:
Hi, I tried serverside includes to try and alter some text on a web page I'm authoring, with the below: <!--#config timefmt="%j" --> <P CLASS="motd centre"> <!--#if expr="\"$DATE_GMT\" < 10"...
9
by: brett | last post by:
I have a main aspx file for my site and use web controls as includes for content. The url may look like this: www.abc.com/main.aspx?page1 I'd like to store content in a text file and...
6
by: MaiyaHolliday | last post by:
Hello, I've recently installed apache on a new computer, and cannot figure out why my site will not process any includes. (it was working on my old one) There are no errors on the page such as...
1
by: Xah Lee | last post by:
Text Processing with Emacs Lisp Xah Lee, 2007-10-29 This page gives a outline of how to use emacs lisp to do text processing, using a specific real-world problem as example. If you don't know...
47
by: mukeshrasm | last post by:
Hi I am calling two pages using Ajax Get_Pages.php and Get_Content.php from combo box. Both pages are displayed based on selection from combo box. Main problem is that it is not showing the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.