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 -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -