473,785 Members | 2,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create a file with FileSystemObjec t

This my code for practice:

<html>
<body>
<%
Response.Write( "6 ")
dim fs,fname
set fs=CreateObject ("Scripting.Fil eSystemObject")
set fname=fs.Create TextFile("f:\te st.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 4361
"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******@NOyah oo.SPAMcom> wrote in news:O9GCn17nDH A.2964
@tk2msftngp13.p hx.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
3343
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
5432
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 the following format (date,headline,article); "181003","news title","news article" "171003","older news title","news article" The form adds the data in reverse chronological order with newest at the top of the list. Now I wish to be able to write...
2
7114
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
3446
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 is created on the server. Any idea?
4
10366
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 ASP sites. JMail, ASPupload, ODBC, OLEDB all work fine, but I keep getting: ActiveX component can't create object: 'Scripting.FileSystemObject'
8
2580
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 the folder does not exsist, create folder "www" and then copy folder "temp" and its contents. If the folder "www" is there, look in it, check to see if the files in folder "temp" are in there, if not, copy the files that are not from folder...
12
22039
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 "ActiveXObject("Scripting.FileSystemObject")", function makefile(){ var fso;var thefile; fso = new ActiveXObject("Scripting.FileSystemObject"); thefile=fso.CreateTextFile("c:\\test.txt",true);
3
2391
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 create object". Does anyone know what is going wrong here? var fso = new ActiveXObject("Scripting.FileSystemObject"); var s = fso.CreateTextFile("C:\test.txt", true); s.WriteLine("helloworld"); s.Close();
0
10357
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10162
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10101
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6744
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.