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=2349
Printed Date: 29 March 2026 at 8:42am
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: 01 May 2003 at 6:26pm

I've talked about this before, but when i tried the advice i was given it doesn't work. I was told that this would work

Server.Execute("/myfolder/"&myvariable)

I need to print the contents of a text file (ext. .txt written in notepad) onto my page. The only catch is that the filename is contained in a variable. The statement before doesn't work. Can anyone help?



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

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



Replies:
Posted By: MorningZ
Date Posted: 01 May 2003 at 8:39pm

"doesnt work"

care to explain that in more detail?  (did it give an error?  did it just spit out nothing? did you reponse.write whats inside the statement and verify it does indeed exist?)



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: pmormr
Date Posted: 02 May 2003 at 5:37pm

Sorry about that, i was in a bit of a rush. Here's the error it gives me.

Server object error 'ASP 0228 : 80004005'

Server.Execute Error

/_stuff/_jokes/joke_display.asp, line 32

The call to Server.Execute failed while loading the page.

no clue what that means. The line prints exactly how i want it.
Server.Execute("/_jokestorage/fiftyfifty.txt")

i would like to try to get this way to work instead of using file system object to print the contents of the file. If there is no other way then i'll use file system object



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

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


Posted By: MorningZ
Date Posted: 02 May 2003 at 6:14pm

two things to try

1) Goto http://www.whateveryourdomainis.com/_jokestorage/fiftyfifty.txt - http://www.whateveryourdomainis.com/_jokestorage/fiftyfifty.txt and see if it is even loadable by a browser
If you get a "404" error then you have the path wrong (fix it), if you get a "403" error, then its not browsable (use FSO to read and spit out)

Then
2) Try using the extension ".inc" instead as maybe the server is getting confused with the text (this #2 is a reach and i dont think its a solution)



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: pmormr
Date Posted: 02 May 2003 at 6:36pm
its browsable. I'm still not sure what happening. It's probably some stupid error that i'm overlooking. thanks for your help

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

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


Posted By: michael
Date Posted: 02 May 2003 at 9:43pm
where is the file relativ to your calling page? if I remeber right, if you got a leading slash "/" then it starts from the root. So if you describe relative path take the / out and try.

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


Posted By: pmormr
Date Posted: 03 May 2003 at 10:50am
thats the ticket! thanks.

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

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



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