c# - Create text file in asp.net using code -


how create text file using asp.net? tried using streamwriter writes exist file:

using (streamwriter _testdata = new streamwriter(server.mappath("~/data.txt"), false)) {                     _testdata.writeline(txttext.text); // write file.     _testdata.writeline(txtlink.text); // write file.                }  

so how create it. have tried:

filesystemobject.createtextfile(filename[,overwrite[,unicode]]); 

but did not work.

string filepath = server.mappath("filename.txt"); string filecontent = "put file content here"; file.writealltext(filepath, filecontent); 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -