Print Page | Close Window

Including a Text File

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=1804
Printed Date: 29 March 2026 at 5:18am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Including a Text File
Posted By: pmormr
Subject: Including a Text File
Date Posted: 13 April 2003 at 7:39pm

I need to include a text file... the name is located in a database (example: myfile.txt). I know this won't work but this is what it would need to do
< !-- #inlcude virtual="/_jokestorage/<%myvariable%> -->
is there anyway to include the text file into the document using a variable as the file name?



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/



Replies:
Posted By: MadDog
Date Posted: 13 April 2003 at 9:15pm

didnt i answer this in another post?

anyways do this:

<% Server.Execute("/_jokestorage/" & myvariable) %>



-------------
http://www.iportalx.net" rel="nofollow">


Posted By: Scotty32
Date Posted: 14 April 2003 at 7:04am

is....
< !-- #inlcude virtual="/_jokestorage/<%myvariable%> -->

and

<% Server.Execute("/_jokestorage/" & myvariable) %>

basically the same? does it do the same thing?



Posted By: pedalcars
Date Posted: 14 April 2003 at 8:09am
No (not here at least) - As includes are included first, (before the scripts are run), you'd get an error because there wont be a file in the /_jokestorage/ folder named "<%myvariable%>"


-------------
http://www.pedalcars.info/ - www.pedalcars.info

The most fun on four wheels



Posted By: pmormr
Date Posted: 14 April 2003 at 8:55am
theres just one problem with using Server.Execute, theres nothing to EXECUTE! Its just one text file with some writing in it and the file name is dynamic.

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: Scotty32
Date Posted: 14 April 2003 at 8:58am

ok, when i asked is "include" the same as "server.execute" i didnt mean the if i use ASP in the include

i ment if ya have a normal include like

<!--#include file="text.txt"-->



Posted By: michael
Date Posted: 14 April 2003 at 2:41pm
no it is not the same. server.execute is faster as it safes a roundtrip to the browser.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: pmormr
Date Posted: 14 April 2003 at 8:14pm
will server.execute have the same the effect of includes? It can't execute a text file that has nothing but text in it.

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: michael
Date Posted: 14 April 2003 at 9:13pm
sure it can

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: MadDog
Date Posted: 14 April 2003 at 9:38pm
Originally posted by pmormr pmormr wrote:

will server.execute have the same the effect of includes? It can't execute a text file that has nothing but text in it.
Yes, it works just like an include. I guess you could say Server.Execute is asp versions of includes.

-------------
http://www.iportalx.net" rel="nofollow">


Posted By: michael
Date Posted: 15 April 2003 at 8:04am
Well there are a few differences that might not come into play on a lot of sites. If you use include for let's say a page that displays memeber, it is pulled before any asp is processed. Again if you use Server.Execute asp is processed where you might do a member cleanup for example and then the server.execute is called, so in an effect the result can be different. Thus MadDog is right in most cases the outcome is similar.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net