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
Post a Comment