473,386 Members | 1,694 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,386 software developers and data experts.

Create a file with FileSystemObject

This my code for practice:

<html>
<body>
<%
Response.Write("6 ")
dim fs,fname
set fs=CreateObject("Scripting.FileSystemObject")
set fname=fs.CreateTextFile("f:\test.txt")
fname.WriteLine("Hello World!")
fname.Close
set fname=nothing
set fs=nothing
%>
</body>
</html>

but I couldn't create the text file at all with no error warning.
How can I do this?

Thanks a lot.

Jul 19 '05 #1
8 4343
"jessie" <al*@ywzc.net> schrieb im Newsbeitrag
news:Xn************************@207.46.248.16...
This my code for practice:

snipped

but I couldn't create the text file at all with no error warning.
How can I do this?


What does the error message say?

The CreateTextFile might fail, because the file already exists (and the
overwrite parameter is not given). Or the CreateTextFile might fail, because
the account does not have enough access rights to the directory.

Michael G. Schneider
Jul 19 '05 #2
What does the error message say?

The CreateTextFile might fail, because the file already exists (and
the overwrite parameter is not given). Or the CreateTextFile might
fail, because the account does not have enough access rights to the
directory.

There is no error message. It is running and nothing comes out.
the overwrite parameter is ture for default, isn't it?
How to give it the right to access to the directory?
Thanks.
Jul 19 '05 #3
"jessie" wrote ...
There is no error message.
You could always try putting some

Response.Write "I got to this step"
Response.Write "Now I am at this step"

etc etc, to see where it gets to before it fails.

You could also check your browser settings to see if you have friendly
errors turned on (if so try turning it off).
the overwrite parameter is ture for default, isn't it?
I believe so, yes.
How to give it the right to access to the directory?


Browse through to the directory you are trying to save the file in,
right-click on it, left-click on properties.
Left-click the security tab, see if the 'IUSR_<computer_name>' account is
listed, if not - try adding it and give it everything but full access (or
give it full access but just for now to test etc).

Now rerun your code - you might want to stick a response.write at the end of
your code to so that you know if its got that far...

Just one question - you showed the F drive above - this will sound daft -
but its not your CD rom drive is it?

Regards

Rob
Jul 19 '05 #4
"jessie" <al*@ywzc.net> schrieb im Newsbeitrag
news:Xn************************@207.46.248.16...
What does the error message say?

The CreateTextFile might fail, because the file already exists (and
the overwrite parameter is not given). Or the CreateTextFile might
fail, because the account does not have enough access rights to the
directory.

There is no error message. It is running and nothing comes out.
the overwrite parameter is ture for default, isn't it?
How to give it the right to access to the directory?


You should look up the CreateTextFile method. I believe, the overwrite is
False by default. The ASP page will be executed under a certain account. If
you do nothing special, this should be the IIS_machine account. This account
needs the access rights to the directory on the IIS Server. For setting the
access right, navigate to the folder, right click, properties, security.

Michael G. Schneider
Jul 19 '05 #5
You could always try putting some

Response.Write "I got to this step"
Response.Write "Now I am at this step" I did this, and I found the problem occurs in the CreateTextFile. If I cut
this line, it is Ok.
Just one question - you showed the F drive above - this will sound
daft - but its not your CD rom drive is it?

It is not my CD rom.

Jul 19 '05 #6
www.aspfaq.com/2180

"jessie" <al*@ywzc.net> wrote in message
news:Xn************************@207.46.248.16...
You could always try putting some

Response.Write "I got to this step"
Response.Write "Now I am at this step"

I did this, and I found the problem occurs in the CreateTextFile. If I cut
this line, it is Ok.
Just one question - you showed the F drive above - this will sound
daft - but its not your CD rom drive is it?

It is not my CD rom.

Jul 19 '05 #7
jessie wrote:
What does the error message say?

The CreateTextFile might fail, because the file already exists (and
the overwrite parameter is not given). Or the CreateTextFile might
fail, because the account does not have enough access rights to the
directory.

There is no error message. It is running and nothing comes out.
the overwrite parameter is ture for default, isn't it?
How to give it the right to access to the directory?
Thanks.


Could this be the problem?
http://www.aspfaq.com/show.asp?id=2180

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #8
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in news:O9GCn17nDHA.2964
@tk2msftngp13.phx.gbl:

Could this be the problem?
http://www.aspfaq.com/show.asp?id=2180

Bob Barrows

Yes, it is!! Thanks!!

Jul 19 '05 #9

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

Similar topics

5
by: Ken Fine | last post by:
I want my application to maintain a directory tree based on months and years, e.g.: 2004 January file file file February file
14
by: StumpY | last post by:
HI, I have set up a page with a form which appends data to a .csv file on my asp server, this is to enable a limited number of users to add news threads to this file, which contains the data in...
2
by: sonu | last post by:
I am tring to create activexobject like var Fo =new ActiveXObject("Scripting.FileSystemObject"); but i am finding error that automation server cant create object any help
4
by: Bnob | last post by:
It is possible to create a file in local user-machine? With this code in code-behind: fs = New System.IO.FileStream(lFileCSV, System.IO.FileMode.Create, System.IO.FileAccess.Write) The file...
4
by: Astra | last post by:
Hi All I know there are numerous postings on the web about this, but none of them seem definitive and they haven't resolved my issue. I'm running WinXP Professional and IIS v5.1 to create my...
8
by: Paw | last post by:
Greetings. I use asp. what I need is is when a visitor comes to the site, I need it to check the host name. if "www.hometowndigest.com" is the host, then check a folder named "something" and if...
12
Fuhrer
by: Fuhrer | last post by:
Hi there, i'm trying to create a javascript function that would create a text file so i can write some informations in it and read it later. I'm using the...
3
by: Elavarasi | last post by:
Hi, I would like to know if it is possible to use JavaScript to write to a text file. I tried using FileSystemObject in JavaScript. However, it gives the following error : "Automation server can't...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.