Appending to a Text File that already exists through an Active Server Page using the OpenTextFile Me

Contributed by
Rating: 3 stars3 stars3 stars3 stars3 stars / 9
September 01, 1999
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

This example uses the OpenTextFile method of FileSystemObject Object.




Example One: Creating a text file through ASP

Creates a text file in a specific directory.
In the 4th line of code just specify how the file gets
opened up. Everytime the ASP page gets opened up
it will create a new file and overwrite any existing data!

<%
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:testfile.txt", ForWriting, True)
f.Write "Hello world!"


%>

Example Two: Appending to a text file through ASP

Appends to a text file in a specific directory.
In the 4th line of code just specify how the file gets
opened up. Everytime the ASP page gets opened up
it will create a new file and append new data to the
existing file!

 

<%
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:testfile.txt", ForAppending, True)
f.Write "Hello world!"

blog comments powered by Disqus
ASP CODE ARTICLES

- ASP Forms
- ASP: The Beginning
- Getting Remote Files With ASP Continued
- Inbox and Outbox Manipulation in ASP
- Relational DropDownList Using VB.NET
- Ad Tracking URL Hits
- Use ViewState to display one record per page...
- Send Email using ASP.NET formatted in HTML
- ASP File Explorer
- ASP/XML Interview questions by Srivatsan Sri...
- Pressing RETURN won't submit the form
- This shows how you get the TEXT of a combo r...
- Group Data by Adrian Forbes
- Multiple checkbox select sample
- Multiple checkbox select with all values sam...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 5 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials