I am just beginning with asp and have gotten an error that I need some
help with. I posted a pair of files to an online ASP host server. The
files are in the same directory; one is readfile.asp which should open
the other which is a simple text file - newText.txt .

Here is readfile.asp :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Reading Text Files</title>
</head>

<body>
<b>An Example of reading a .txt file and hopefully adding some
formatting.</b>
<hr>
<%

set tfile=Server.CreateObject("Scripting.FileSystemObject")
set TFStream=tfile.OpenTextFile("newText.txt")
textprinter=TFStream.readall()

%>
<p>
<%=textprinter%>

</body>
</html>

Here is the error msg that results:

Microsoft VBScript runtime error '800a0035'
File not found
/Test-BDT/readfile.asp, line 13

Where line 13 is:
set tfile=Server.CreateObject("Scripting.FileSystemObject")


MY Qustions:

-Why didn't it work?
-How do I get it to work? (I suppost I could do a server side include,
but I'd like to figure out the how& why of this code first.
-I may have a path problem. Can someone point me to a good reference
about referencing path in this code?

thanks a lot, BDT

Re: help with Server.CreateObject("Scripting.FileSystemObject") by Steven

Steven
Tue Jun 22 13:05:05 CDT 2004

Change;

set TFStream=tfile.OpenTextFile("newText.txt")

to

set TFStream=tfile.OpenTextFile(Server.MapPath("newText.txt"))

Btw, unless I'm mistaken (and no offence intended), shouldn't you already
know this if your offering advice to others that do not?

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!


"bt" <bt@.com> wrote in message
news:4nsgd0hn2207cq1k403b9j70mejhts0b83@4ax.com...
>
> I am just beginning with asp and have gotten an error that I need some
> help with. I posted a pair of files to an online ASP host server. The
> files are in the same directory; one is readfile.asp which should open
> the other which is a simple text file - newText.txt .
>
> Here is readfile.asp :
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
> <html>
> <head>
> <title>Reading Text Files</title>
> </head>
>
> <body>
> <b>An Example of reading a .txt file and hopefully adding some
> formatting.</b>
> <hr>
> <%
>
> set tfile=Server.CreateObject("Scripting.FileSystemObject")
> set TFStream=tfile.OpenTextFile("newText.txt")
> textprinter=TFStream.readall()
>
> %>
> <p>
> <%=textprinter%>
>
> </body>
> </html>
>
> Here is the error msg that results:
>
> Microsoft VBScript runtime error '800a0035'
> File not found
> /Test-BDT/readfile.asp, line 13
>
> Where line 13 is:
> set tfile=Server.CreateObject("Scripting.FileSystemObject")
>
>
> MY Qustions:
>
> -Why didn't it work?
> -How do I get it to work? (I suppost I could do a server side include,
> but I'd like to figure out the how& why of this code first.
> -I may have a path problem. Can someone point me to a good reference
> about referencing path in this code?
>
> thanks a lot, BDT
>
>
>
>



Re: help with Server.CreateObject("Scripting.FileSystemObject") by bt

bt
Wed Jun 23 10:59:54 CDT 2004

Many thanks, it worked like a charm.

I think that I figured out what was wrong with my 'version'. I copied
it from a book that I'm working thru, but the book assumes that one is
working with a local PWS/IIS, not a remote internet host. Does that
explain my original problem?

I must admit that I haven't yet got a firm grasp of this stuff. I've
done a bit HTML and JavaScript over the years, but ASP is all new to
me. Since most of the references I've used refer to local PWS/IIS
instead of a remote internet host, it's been even more difficult. I
have posted a separate request for an 'ASP book recommendation' and
got some good ideas to pursue.

Again, thanks for the info. By the way, I didn't follow your comment
about my 'offering advise to others.' I'm sure not intending to do
that and I'm not sure how I gave that appearance.

cheers, BDT


On Tue, 22 Jun 2004 19:05:05 +0100, "Steven Burn" <pvt@noyb.com>
wrote:

>Change;
>
>set TFStream=tfile.OpenTextFile("newText.txt")
>
>to
>
>set TFStream=tfile.OpenTextFile(Server.MapPath("newText.txt"))
>
>Btw, unless I'm mistaken (and no offence intended), shouldn't you already
>know this if your offering advice to others that do not?


Re: help with Server.CreateObject("Scripting.FileSystemObject") by Steven

Steven
Wed Jun 23 17:26:45 CDT 2004

Glad you got it sorted out :o)

As for my comment, just ignore me.... I assumed something from;

************************
<title>Reading Text Files</title>
</head>

<body>
<b>An Example of reading a .txt file and hopefully adding some
formatting.</b>
************************

and obviously shouldn't have..... (I do that occasionally)

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!


"bt" <bt@.com> wrote in message
news:vh8jd0lcdhqsvao624iedoalmkq3vkdu4s@4ax.com...
> Many thanks, it worked like a charm.
>
> I think that I figured out what was wrong with my 'version'. I copied
> it from a book that I'm working thru, but the book assumes that one is
> working with a local PWS/IIS, not a remote internet host. Does that
> explain my original problem?
>
> I must admit that I haven't yet got a firm grasp of this stuff. I've
> done a bit HTML and JavaScript over the years, but ASP is all new to
> me. Since most of the references I've used refer to local PWS/IIS
> instead of a remote internet host, it's been even more difficult. I
> have posted a separate request for an 'ASP book recommendation' and
> got some good ideas to pursue.
>
> Again, thanks for the info. By the way, I didn't follow your comment
> about my 'offering advise to others.' I'm sure not intending to do
> that and I'm not sure how I gave that appearance.
>
> cheers, BDT
>
>
> On Tue, 22 Jun 2004 19:05:05 +0100, "Steven Burn" <pvt@noyb.com>
> wrote:
>
> >Change;
> >
> >set TFStream=tfile.OpenTextFile("newText.txt")
> >
> >to
> >
> >set TFStream=tfile.OpenTextFile(Server.MapPath("newText.txt"))
> >
> >Btw, unless I'm mistaken (and no offence intended), shouldn't you already
> >know this if your offering advice to others that do not?
>