Two ways to generate text files in ASP _asp Foundation

Source: Internet
Author: User
Two common ways to generate files in ASP are to generate files using ADODB.stream and generate files using Scripting.FileSystemObject

1, Scripting.FileSystemObject Generation file method:
Copy Code code as follows:
<%
Set fso = CreateObject ("Scripting.FileSystemObject")
File=server.mappath ("To generate file path and filename. htm")
Set Txt=fso. OpenTextFile (File,8,true)
data1= File Contents using WriteLine method to generate files
Txt. WriteLine data1
data2= "File contents" to generate files using the Write method
Txt. Write data2
Txt. Close
Txt.fso
%>


2, ADODB. Stream generate File Method:
Copy Code code as follows:
<% 
dim objadostream 
set objadostream  = server.createobject ("ADODB.") Stream ")  
objadostream.type = 1 
Objadostream.open ()  
Objadostream.write (" File contents ")  
objadostream.savetofile  to generate file paths and filenames .htm,2 
Objadostream.close ()  
%>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.