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.

Re: Create a file with FileSystemObject by Michael

Michael
Fri Oct 31 06:55:46 CST 2003

"jessie" <all@ywzc.net> schrieb im Newsbeitrag
news:Xns94257BC3C2408allywzcnet@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



Re: Create a file with FileSystemObject by jessie

jessie
Fri Oct 31 07:20:48 CST 2003


> 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.

Re: Create a file with FileSystemObject by Rob

Rob
Fri Oct 31 07:32:20 CST 2003

"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



Re: Create a file with FileSystemObject by Michael

Michael
Fri Oct 31 07:33:26 CST 2003

"jessie" <all@ywzc.net> schrieb im Newsbeitrag
news:Xns94258774CFC02allywzcnet@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



Re: Create a file with FileSystemObject by jessie

jessie
Fri Oct 31 08:29:14 CST 2003


> 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.


Re: Create a file with FileSystemObject by Aaron

Aaron
Fri Oct 31 08:39:52 CST 2003

www.aspfaq.com/2180



"jessie" <all@ywzc.net> wrote in message
news:Xns9425930EA9FC7allywzcnet@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.
>



Re: Create a file with FileSystemObject by Bob

Bob
Fri Oct 31 08:43:44 CST 2003

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.



Re: Create a file with FileSystemObject by jessie

jessie
Fri Oct 31 11:06:46 CST 2003

"Bob Barrows" <reb01501@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!!