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

help with Server.CreateObject("Scripting.FileSystemObject")

bt

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.FileSystemObj ect")
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.FileSystemObj ect")
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


Jul 19 '05 #1
3 3415
Change;

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

to

set TFStream=tfile.OpenTextFile(Server.MapPath("newTex t.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:4n********************************@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.FileSystemObj ect")
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.FileSystemObj ect")
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

Jul 19 '05 #2
bt
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" <pv*@noyb.com>
wrote:
Change;

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

to

set TFStream=tfile.OpenTextFile(Server.MapPath("newTex t.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?


Jul 19 '05 #3
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:vh********************************@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" <pv*@noyb.com>
wrote:
Change;

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

to

set TFStream=tfile.OpenTextFile(Server.MapPath("newTex t.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?

Jul 19 '05 #4

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

Similar topics

2
by: Lin Ma | last post by:
Greetings, Is it possbile to check a file exist without using Server.CreateObject("Scripting.FileSystemObject") in asp page?? The reason is our hosting company turn that function off for...
5
by: Andrew | last post by:
Hi, experts, My system has a problem when I invoke the fileSystemObject to create a text file (it worked ok long before.) The asp seems running, but actually never finishes. I don't know what I...
0
by: Michael | last post by:
I have a problem forcing files to download. If I select Save the document is saved with no problems. If I select "Open" the document is empty or I get a "File not found" error from the application...
2
by: Stavros | last post by:
Hi all when I execute the following VB6 code in Windows 2000 and as an Administrator, everything is working fine. Project->References->"Microsoft Scripting Runtime" and scrrun.dll is located...
4
by: MoF | last post by:
Hello! I have for a long time used the line: Set FS=Server.CreateObject("Scripting.FileSystemObject") in my ASP code. Suddenly one day this week it stopped working and I now get the error: ...
1
by: chsmith | last post by:
I'm calling a .net / c# .dll from .ASP via Server.CreateObject(). I regasm, gacutil /i and all runs fine on XP SP1 or older. SP2 registry subracts System (??) from the registry root nodes and...
0
by: hellind | last post by:
When the form is submitted as ENCTYPE="multipart/form-data" using AspUpload component, I understand to use Upload.form("") to retreive the form elements. But I cannot retreive it from inside a class....
3
by: =?Utf-8?B?VG9kZA==?= | last post by:
trying to access files located on another server within the network. the folder is shared out and we created a virtual directory as well. The error is Microsoft VBScript runtime error '800a004c'...
7
by: Benjamins via AccessMonster.com | last post by:
Hi, I have meet a problem for CreateObject("Scripting.FileSystemObject"). I uses this code to get the information of the harddisk I have 10 user using the same code. All where working fine...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.