FREE tutorial,solution,RSS Feeds on Operating Systems, Programming, Web Development, Applications, Databases, Networking, Hardware, Security, SEO Free Expertsforge Membership
Join us as Moderator
Submit Article to Expertsforge.com Submit Article My Expertsforge
 
RSS Feeds, Help Help RSS Feeds
bannertop
 

ASP Tutorial: Create and write content to a text file using ASP

jawahar
2/3/2005 4:44:07 AM, Views: 3969
The following tutorial and code can be used to create a text file(or any file) in the web server using asp

<%
'Declare variables for the File System Object and the File to be accessed.
Dim objFSO, objTextFile

'Create an instance of the the File System Object and assign it to objFSO.
Set objFSO = CreateObject("Scripting.FileSystemObject")

'Open the file
Set objTextFile = objFSO.CreateTextFile(Server.MapPath("textfile.txt"))

'Writing to file "textfile.txt".
objTextFile.WriteLine "This text is in the file ""textfile.txt""!" %>
objTextFile.WriteLine "The file was written on " & Date() & " at " & Time() & "."

'Close the file.
objTextFile.Close

'Release reference to the text file.
Set objTextFile = Nothing

'Release reference to the File System Object.
Set objFSO = Nothing
%>
Next Steps:
Add this Tutorial to:
Blink Blink del.icio.ous Del.icio.us Digg Digg
Fark Fark Furl Furl Google Google
Reddit Reddit Simpy Simpy Spurl Spurl
Technorati Technorati Windows Live Win Live Yahoo Yahoo
Rate Me!
Not Yet Rated!
Rate:
Send Private MessageSend Message
Signup / Login To View the Solution or Provide Comments
Post Comment/Solution
Comment:*
        (Link Rules) 
  Use : [bold] for <b>; [/bold] for </b>; [italic] for <i>; [/italic] for </i>; [code] & [/code] for code
 
Categories
Options
ASP RSS Feed
Most Popular Tutorial
Most Popular Solution
Top Rated
Top Rankers
Overall
1. jawahar (3000)
Yearly -2008
1. jawahar (200)
Expertsforge Sponsors
bnrtop